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

Port cargo to clap3 #10265

Merged
merged 12 commits into from Jan 12, 2022
Merged

Port cargo to clap3 #10265

merged 12 commits into from Jan 12, 2022

Commits on Jan 6, 2022

  1. Upgrade to Clap 3

    - One parser change found by `cargo_config::includes` is that clap 2
      would ignore any values after a `=` for flags.
      `cargo config --show-origin` is a flag but the test passed `--show-origin=yes` which
      happens to give the desired result for that test but is the same as
      `--show-origin=no` or `--show-origin=alien-invasion`.
    - The parser now panics when accessing an undefined attribute but clap
      takes advantage of that for sharing code across commands that have
      different subsets of arguments defined.  I've extended clap so we can
      "look before you leap" and put the checks at the argument calls to
      start off with so its very clear what is tenuously shared.  This
      allows us to go in either direction in the future, either addressing
      how we are sharing between commands or by moving this down into the
      extension methods and pretending this clap feature doesn't exist
    - On that topic, a test found clap-rs/clap#3263.  For now, there is a
      hack in clap.  Depending on how we fix that in clap for clap 4.0, we
      might need to re-address things in cargo.
    - `value_of_os` now requires setting `allow_invalid_utf8`, otherwise it
      asserts.  To help catch this, I updated the argument definitions
      associated with lookups reported by:
      - `rg 'values?_os' src/`
      - `rg 'values?_of_os' src/`
    - clap now reports `2` for usage errors, so we had to bypass clap's
      `exit` call to keep the same exit code.
    
    BREAKING CHANGE: API now uses clap3
    epage committed Jan 6, 2022
    Copy the full SHA
    f17ecaf View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    88a122c View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    5435b26 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    f3ec865 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    2aa4e9f View commit details
    Browse the repository at this point in the history
  6. Copy the full SHA
    f9b28cf View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    aed0312 View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    5cd062e View commit details
    Browse the repository at this point in the history
  9. Copy the full SHA
    0ab4d0c View commit details
    Browse the repository at this point in the history
  10. Copy the full SHA
    24f301b View commit details
    Browse the repository at this point in the history
  11. Copy the full SHA
    6e08a30 View commit details
    Browse the repository at this point in the history
  12. refactor: Resolve Arg::multiple deprecation

    Note: `cargo vendor --sync` did not use `multi_opt` and so it has both
    multiple occurrences **and** multiple values.  If we want to deprecate
    this, we'll need `unstable-grouped` to be stablized (or pin our clap
    version) and ensure each group has only 1 value.
    epage committed Jan 6, 2022
    Copy the full SHA
    92fa72d View commit details
    Browse the repository at this point in the history