on main help sign in
refactor: make install noninteractive terminal friendly
commit75adb1696afb5f1da24d6e991ff2324f8b6fcd95 authorrobcholz <84130577+robcholz@users.noreply.github.com> dateSat 7 Feb 2026, 22:25 (8 months ago) parent57ebe7f
1 file changed+26−22
install+26−22
install+26−22
@@ -47,36 +47,40 @@ ensure_cargo() {
4747
4848 print_message warning "Rust (cargo) is required but not found."
4949 print_message info "You should review and approve the Rust installer before proceeding."
50+ reply=""
5051 if [[ -t 0 ]]; then
5152 read -r -p "Install Rust using rustup now? (y/N) " reply
52− case "${reply}" in
53− y|Y)
54− if command -v curl >/dev/null 2>&1; then
55− curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
56− elif command -v wget >/dev/null 2>&1; then
57− wget -qO- https://sh.rustup.rs | sh -s -- -y
58− else
59− print_message error "Missing required command: curl or wget"
60− print_message info "Install Rust manually from https://rustup.rs and retry."
61− exit 1
62− fi
63− # shellcheck source=/dev/null
64− if [[ -f "$HOME/.cargo/env" ]]; then
65− # shellcheck disable=SC1090
66− source "$HOME/.cargo/env"
67− fi
68− ;;
69− *)
70− print_message info "Install Rust manually from https://rustup.rs and retry."
71− exit 1
72− ;;
73− esac
53+ elif [[ -r /dev/tty ]]; then
54+ read -r -p "Install Rust using rustup now? (y/N) " reply </dev/tty
7455 else
7556 print_message error "Non-interactive shell: cannot prompt to install Rust."
7657 print_message info "Install Rust manually from https://rustup.rs and retry."
7758 exit 1
7859 fi
7960
61+ case "${reply}" in
62+ y|Y)
63+ if command -v curl >/dev/null 2>&1; then
64+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
65+ elif command -v wget >/dev/null 2>&1; then
66+ wget -qO- https://sh.rustup.rs | sh -s -- -y
67+ else
68+ print_message error "Missing required command: curl or wget"
69+ print_message info "Install Rust manually from https://rustup.rs and retry."
70+ exit 1
71+ fi
72+ # shellcheck source=/dev/null
73+ if [[ -f "$HOME/.cargo/env" ]]; then
74+ # shellcheck disable=SC1090
75+ source "$HOME/.cargo/env"
76+ fi
77+ ;;
78+ *)
79+ print_message info "Install Rust manually from https://rustup.rs and retry."
80+ exit 1
81+ ;;
82+ esac
83+
8084 if ! command -v cargo >/dev/null 2>&1; then
8185 print_message error "Cargo still not available after installation."
8286 print_message info "Open a new shell or run: source \"$HOME/.cargo/env\""