@@ -38,9 +38,54 @@ require_cmd() {
41−require_cmd cargo "Install Rust (cargo) from https://rustup.rs and retry."
42require_cmd git "Install git and retry."
41require_cmd git "Install git and retry."
44+ if command -v cargo >/dev/null 2>&1; then
48+ print_message warning "Rust (cargo) is required but not found."
49+ print_message info "You should review and approve the Rust installer before proceeding."
51+ read -r -p "Install Rust using rustup now? (y/N) " reply
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
59+ print_message error "Missing required command: curl or wget"
60+ print_message info "Install Rust manually from https://rustup.rs and retry."
63+ # shellcheck source=/dev/null
64+ if [[ -f "$HOME/.cargo/env" ]]; then
65+ # shellcheck disable=SC1090
66+ source "$HOME/.cargo/env"
70+ print_message info "Install Rust manually from https://rustup.rs and retry."
75+ print_message error "Non-interactive shell: cannot prompt to install Rust."
76+ print_message info "Install Rust manually from https://rustup.rs and retry."
80+ if ! command -v cargo >/dev/null 2>&1; then
81+ print_message error "Cargo still not available after installation."
82+ print_message info "Open a new shell or run: source \"$HOME/.cargo/env\""
44CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
89CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
45INSTALL_DIR="$CARGO_HOME/bin"
90INSTALL_DIR="$CARGO_HOME/bin"