The source code shows the long option --no-prompt as being the same as -y, but that doesn't actually work with the latest rustup:
$ curl -ssLO https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init
$ chmod +x rustup-init
$ ./rustup-init --help
rustup-init 1.0.0 (17b6d21 2016-12-15)
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
I discovered this after attempting to install Rust non-interactively on Circle CI and it errored:
curl https://sh.rustup.rs -sSf | sh -s -- --no-prompt
info: downloading installer
error: Found argument '--no-prompt' which wasn't expected, or isn't valid in this context
USAGE:
rustup-init [FLAGS] [OPTIONS]
For more information try --help
rustup: command failed: /tmp/tmp.6EPokPxxSk/rustup-init --no-prompt
curl https://sh.rustup.rs -sSf | sh -s -- --no-prompt returned exit code 1
Action failed: curl https://sh.rustup.rs -sSf | sh -s -- --no-prompt
You seem to have mistaken an internal lookup key for an option dictionary data structure as a long command line option. According to the documents of the clap command line parser,
rustup-init has never supported a long command line option --no-prompt. Compare these two:
.arg(Arg::with_name("no-prompt")
.short("y")
.help("Disable confirmation prompt."))
.arg(Arg::with_name("verbose")
.short("v")
.long("verbose")
.help("Enable verbose output"))
the latter of which surely accepts both -v and --verbose.
Ah, you are correct! I guess I will close this. Thanks!
I gathered from this that
curl https://sh.rustup.rs -sSf | sh -s -- -y
is what you need to run in order to skip the prompts.
--
Could someone explain or direct me to documentation on the -- part of that sh command? I didn't know I have to do that in order to pass an option to the rust install script.
I was trying to run it like this, previously:
curl https://sh.rustup.rs -sSf | sh -s -y
and was failing.
@lmj0011 sh needs -- in order to separate command line parameters given to itself from those given to the script that it's interpreting. In your case, -s is meant to be an option for the sh command whereas you want to pass -y to the Rust installer script, hence -- between them.
My understanding is it's merely a decades-old convention but POSIX "Utility Syntax Guidelines" gives some legitimacy to it
Most helpful comment
I gathered from this that
is what you need to run in order to skip the prompts.
--
Could someone explain or direct me to documentation on the
--part of thatshcommand? I didn't know I have to do that in order to pass an option to the rust install script.I was trying to run it like this, previously:
and was failing.