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

Upgrading clap to 4.0.x #136

Closed
MitchellBerend opened this issue Oct 10, 2022 · 3 comments · Fixed by #137
Closed

Upgrading clap to 4.0.x #136

MitchellBerend opened this issue Oct 10, 2022 · 3 comments · Fixed by #137
Labels
dependencies enhancement New feature or request good first issue Good for newcomers hacktoberfest https://hacktoberfest.com/
Milestone

Comments

@MitchellBerend
Copy link
Collaborator

While looking into #133 I ran into a versioning issue between clap and clap_completion. I noticed there was a 4.0 release for clap.

Is it too early to bump the clap version since the 4.0 release was on 2022 09 28? The project passes all tests and compiles and from my own testing everything works as expected. There are a couple of deprecation warnings when running cargo clippy --features clap/deprecated but these are easily fixable.

The main advantage I see are improved help text generation and the auto completion features.

help text 3.2.17

$ cargo run -- --help 
    Updating crates.io index
   Compiling tool-sync v0.2.0 (/home/mitchell/rust/tool-sync)
    Finished dev [unoptimized + debuginfo] target(s) in 2.32s
     Running `target/debug/tool --help`
tool-sync 0.2.0
Dmitrii Kovanikov <kovanikov@gmail.com>
A CLI tool to manage other CLI tools

USAGE:
    tool [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -c, --config <FILE>    Sets a path to a configuration file (default: $HOME/.tool.toml)
    -h, --help             Print help information
    -p, --proxy <uri>      
    -V, --version          Print version information

SUBCOMMANDS:
    completion        Generate Bash completion to get bash shell completion to work you can add
                          `eval "$(tool-sync completion)"` to your ~/.bashrc
    default-config    Print a default .tool.toml configuration to std out
    help              Print this message or the help of the given subcommand(s)
    install           Install a tool if it is hardcoded into internal database
    sync              Sync all tools specified in configuration file or the only one specified
                          in the command line

help text 4.0.x

$ cargo run -- --help 
    Updating crates.io index
   Compiling tool-sync v0.2.0 (/home/mitchell/rust/tool-sync)
    Finished dev [unoptimized + debuginfo] target(s) in 3.23s
     Running `target/debug/tool --help`
A CLI tool to manage other CLI tools

Usage: tool [OPTIONS] <COMMAND>

Commands:
  completion      Generate Bash completion to get bash shell completion to work you can add `eval "$(tool-sync completion)"` to your ~/.bashrc
  sync            Sync all tools specified in configuration file or the only one specified in the command line
  default-config  Print a default .tool.toml configuration to std out
  install         Install a tool if it is hardcoded into internal database
  help            Print this message or the help of the given subcommand(s)

Options:
  -c, --config <FILE>  Sets a path to a configuration file (default: $HOME/.tool.toml)
  -p, --proxy <uri>    
  -h, --help           Print help information
  -V, --version        Print version information

image

image

The shell suggestions from the last screenshot also work on 3.x.

@chshersh chshersh added enhancement New feature or request good first issue Good for newcomers dependencies hacktoberfest https://hacktoberfest.com/ labels Oct 11, 2022
@chshersh
Copy link
Owner

Is it too early to bump the clap version since the 4.0 release was on 2022 09 28?

No, I don't think so. Upgrading clap sounds like a good idea 👍🏻
tool-sync hasn't been updating dependencies for a while. So it might be a good opportunity to update all the dependencies at once.

But we still might want to upgrade clap separately from other dependencies to make PRs smaller, easier to review and localise all the required changes in a single patch.

@SanchithHegde
Copy link
Contributor

Could I pick this up?

@MitchellBerend
Copy link
Collaborator Author

@SanchithHegde sure, im not working on it.

@chshersh chshersh added this to the v0.3.0: Auto milestone Oct 12, 2022
chshersh pushed a commit that referenced this issue Oct 14, 2022
Resolves #136

This PR upgrades the `clap` dependency to `4.0`.

I can also upgrade the other dependencies in the same PR itself, since
they only involve modifications to the `Cargo.toml` and `Cargo.lock`
files, `clippy` lints and tests pass without any code modifications.


### Additional tasks

- [ ] Documentation for changes provided/changed
- [ ] Tests added
- [ ] Updated CHANGELOG.md

---

PS: I'm unsure if this requires a changelog entry, I can add one if
required.
@SanchithHegde SanchithHegde mentioned this issue Oct 14, 2022
3 tasks
chshersh pushed a commit that referenced this issue Oct 15, 2022
As discussed in #136 and #137, this PR upgrades dependencies to their
latest versions.

### Additional tasks

- [ ] Documentation for changes provided/changed
- [ ] Tests added
- [ ] Updated CHANGELOG.md

---

Aside, have you considered setting up either Dependabot or Renovate for
handling updates to both Rust dependencies and GitHub Actions?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies enhancement New feature or request good first issue Good for newcomers hacktoberfest https://hacktoberfest.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants