Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added argument-documentation to rustup-init.sh #962

Merged
merged 1 commit into from
Mar 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 43 additions & 14 deletions rustup-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
rustup-init 1.0.0 (408ed84 2017-02-11)
The installer for rustup

USAGE:
rustup-init [FLAGS] [OPTIONS]

FLAGS:
-v, --verbose Enable verbose output
-y Disable confirmation prompt.
--no-modify-path Don't configure the PATH environment variable
-h, --help Prints help information
-V, --version Prints version information

OPTIONS:
--default-host <default-host> Choose a default host triple
--default-toolchain <default-toolchain> Choose a default toolchain to install
EOF
}

main() {
need_cmd uname
need_cmd curl
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/rustup-cli/setup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down