Skip to content

Commit 7d1de03

Browse files
committed
Auto merge of #962 - aarthiJ:feature/argument-documentation, r=brson
Added argument-documentation to rustup-init.sh fixes: #652
2 parents edbab96 + b1a1ff5 commit 7d1de03

File tree

2 files changed

+44
-15
lines changed

2 files changed

+44
-15
lines changed

rustup-init.sh

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,28 @@ set -u
1717

1818
RUSTUP_UPDATE_ROOT="https://static.rust-lang.org/rustup/dist"
1919

20+
#XXX: If you change anything here, please make the same changes in setup_mode.rs
21+
usage() {
22+
cat 1>&2 <<EOF
23+
rustup-init 1.0.0 (408ed84 2017-02-11)
24+
The installer for rustup
25+
26+
USAGE:
27+
rustup-init [FLAGS] [OPTIONS]
28+
29+
FLAGS:
30+
-v, --verbose Enable verbose output
31+
-y Disable confirmation prompt.
32+
--no-modify-path Don't configure the PATH environment variable
33+
-h, --help Prints help information
34+
-V, --version Prints version information
35+
36+
OPTIONS:
37+
--default-host <default-host> Choose a default host triple
38+
--default-toolchain <default-toolchain> Choose a default toolchain to install
39+
EOF
40+
}
41+
2042
main() {
2143
need_cmd uname
2244
need_cmd curl
@@ -53,6 +75,23 @@ main() {
5375
fi
5476
fi
5577

78+
# check if we have to use /dev/tty to prompt the user
79+
local need_tty=yes
80+
for arg in "$@"; do
81+
case "$arg" in
82+
-h|--help)
83+
usage
84+
exit 0
85+
;;
86+
-y)
87+
# user wants to skip the prompt -- we don't need /dev/tty
88+
need_tty=no
89+
;;
90+
*)
91+
;;
92+
esac
93+
done
94+
5695
if $_ansi_escapes_are_valid; then
5796
printf "\33[1minfo:\33[0m downloading installer\n" 1>&2
5897
else
@@ -68,18 +107,6 @@ main() {
68107
exit 1
69108
fi
70109

71-
# check if we have to use /dev/tty to prompt the user
72-
local need_tty=yes
73-
for arg in "$@"; do
74-
case "$arg" in
75-
-y)
76-
# user wants to skip the prompt -- we don't need /dev/tty
77-
need_tty=no
78-
;;
79-
*)
80-
;;
81-
esac
82-
done
83110

84111

85112
if [ "$need_tty" = "yes" ]; then
@@ -146,8 +173,10 @@ get_architecture() {
146173
local _ostype="$(uname -s)"
147174
local _cputype="$(uname -m)"
148175

149-
if [ "$(uname -o)" = Android ]; then
150-
local _ostype=Android
176+
if [ "$_ostype" = Linux ]; then
177+
if [ "$(uname -o)" = Android ]; then
178+
local _ostype=Android
179+
fi
151180
fi
152181

153182
if [ "$_ostype" = Darwin -a "$_cputype" = i386 ]; then

src/rustup-cli/setup_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn main() -> Result<()> {
1313
if arg1 == Some("--self-replace") {
1414
return self_update::self_replace();
1515
}
16-
16+
// XXX: If you change anything here, please make the same changes in rustup-init.sh
1717
let cli = App::new("rustup-init")
1818
.version(common::version())
1919
.about("The installer for rustup")

0 commit comments

Comments
 (0)