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

--no-prompt option to rustup-init fails #1031

Closed
jimmycuadra opened this issue Apr 5, 2017 · 4 comments
Closed

--no-prompt option to rustup-init fails #1031

jimmycuadra opened this issue Apr 5, 2017 · 4 comments

Comments

@jimmycuadra
Copy link
Contributor

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
@nodakai
Copy link
Contributor

nodakai commented Apr 23, 2017

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.

@jimmycuadra
Copy link
Contributor Author

Ah, you are correct! I guess I will close this. Thanks!

@lmj0011
Copy link

lmj0011 commented Dec 26, 2017

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.

@nodakai
Copy link
Contributor

nodakai commented Dec 27, 2017

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants