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

fix(update): Make -p more convenient by being positional #12545

Merged
merged 2 commits into from
Aug 29, 2023

Commits on Aug 23, 2023

  1. fix(update): Make -p more convenient by being positional

    Generally, cargo avoids positional arguments.  Mostly for the commands
    that might forward arguments to another command, like `cargo test`.
    It also allows some flexibility in turning flags into options.
    
    For `cargo add` and `cargo remove`, we decided to accept positionals
    because the motivations didn't seem to apply as much (similar to `cargo
    install`).
    
    This applies the pattern to `cargo update` as well which is in the same
    category of commands as `cargo add` and `cargo remove`.
    
    As for `--help` formatting, I'm mixed on whether `[SPEC]...` should be at the top like
    other positionals or should be relegated to "Package selection".  I went
    with the latter mostly to make it easier to visualize the less common
    choice.
    
    Switching to a positional for `cargo update` (while keeping `-p` for
    backwards compatibility) was referenced in rust-lang#12425.
    epage committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    4bf1af0 View commit details
    Browse the repository at this point in the history
  2. fix(update): Improve error on bad argument order

    This is inspired by `cargo install`
    epage committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    dc37222 View commit details
    Browse the repository at this point in the history