nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Inconsistent documentation for `cargo install-update-config` #197

Closed TehPers closed 2 years ago

TehPers commented 2 years ago

cargo install-update-config --help returns documentation containing the following usage string:

USAGE:
    cargo install-update-config [FLAGS] [OPTIONS] <PACKAGE>

However, if you try to do cargo install-update-config --feature extra nu, you get the following error:

error: The following required arguments were not provided:
    <PACKAGE>

USAGE:
    cargo install-update-config <PACKAGE> --feature <FEATURE>...

For more information try --help

The help text and the error message put the options in different locations. It would be nice if the options could be specified either before or after the package name, but for now it might be helpful to correct the help string so that the <PACKAGE> appears before [FLAGS] and [OPTIONS].

I am using v9.0.0 installed through cargo install cargo-update.

nabijaczleweli commented 2 years ago

hm. those are, respectively:

                        Arg::from_usage("-f --feature=[FEATURE]... 'Feature to enable'"),
                        Arg::from_usage("-n --no-feature=[DISABLED_FEATURE]... 'Feature to disable'"),

                        Arg::from_usage("<PACKAGE> 'Package to configure'").empty_values(false)]))

so that should actually work as advertised; I can also reproduce this:

$ target/debug/cargo-install-update-config install-update-config -f a tarpaulin
error: The following required arguments were not provided:
    <PACKAGE>

USAGE:
    cargo install-update-config <PACKAGE> --feature <FEATURE>...

For more information try --help

This is in clear violation of the USG, and has no right to happen. what the hell is clap smoking. how do you specify an operand if you specify -f.

nabijaczleweli commented 2 years ago

Apparently this is a documented "feature" – https://docs.rs/clap/2.33.3/clap/struct.Arg.html#additional-sigils. Normal day.

Can you try the current master branch (at least a9aba93e236166d73d681017319dcb8f3f3a2005)?

TehPers commented 2 years ago

Tested with a9aba93 and it seems to be working. Thanks!

$ cargo install-update-config --feature extra2 nu
Default features  true
Features          extra
                  extra2
nabijaczleweli commented 2 years ago

Great, fixed in v10.0.0