From b1a1ff50fb27a7e387d7bd293ac19739c9d77e94 Mon Sep 17 00:00:00 2001 From: Aarthi Janakiraman Date: Sat, 25 Feb 2017 16:04:18 -0500 Subject: [PATCH] added argument-documentation to rustup-init.sh --- rustup-init.sh | 57 +++++++++++++++++++++++++++--------- src/rustup-cli/setup_mode.rs | 2 +- 2 files changed, 44 insertions(+), 15 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index 4c5445729f..8aaf3d0720 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -17,6 +17,28 @@ set -u RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup/dist" +#XXX: If you change anything here, please make the same changes in setup_mode.rs +usage() { + cat 1>&2 < Choose a default host triple + --default-toolchain Choose a default toolchain to install +EOF +} + main() { need_cmd uname need_cmd curl @@ -53,6 +75,23 @@ main() { fi fi + # check if we have to use /dev/tty to prompt the user + local need_tty=yes + for arg in "$@"; do + case "$arg" in + -h|--help) + usage + exit 0 + ;; + -y) + # user wants to skip the prompt -- we don't need /dev/tty + need_tty=no + ;; + *) + ;; + esac + done + if $_ansi_escapes_are_valid; then printf "\33[1minfo:\33[0m downloading installer\n" 1>&2 else @@ -68,18 +107,6 @@ main() { exit 1 fi - # check if we have to use /dev/tty to prompt the user - local need_tty=yes - for arg in "$@"; do - case "$arg" in - -y) - # user wants to skip the prompt -- we don't need /dev/tty - need_tty=no - ;; - *) - ;; - esac - done if [ "$need_tty" = "yes" ]; then @@ -146,8 +173,10 @@ get_architecture() { local _ostype="$(uname -s)" local _cputype="$(uname -m)" - if [ "$(uname -o)" = Android ]; then - local _ostype=Android + if [ "$_ostype" = Linux ]; then + if [ "$(uname -o)" = Android ]; then + local _ostype=Android + fi fi if [ "$_ostype" = Darwin -a "$_cputype" = i386 ]; then diff --git a/src/rustup-cli/setup_mode.rs b/src/rustup-cli/setup_mode.rs index 26191f257c..f309d104cc 100644 --- a/src/rustup-cli/setup_mode.rs +++ b/src/rustup-cli/setup_mode.rs @@ -13,7 +13,7 @@ pub fn main() -> Result<()> { if arg1 == Some("--self-replace") { return self_update::self_replace(); } - + // XXX: If you change anything here, please make the same changes in rustup-init.sh let cli = App::new("rustup-init") .version(common::version()) .about("The installer for rustup")