chshersh / tool-sync

🧰 Download pre-built binaries of all your favourite tools with a single command
https://crates.io/crates/tool-sync
Mozilla Public License 2.0
69 stars 16 forks source link

Upgrading clap to 4.0.x #136

Closed MitchellBerend closed 1 year ago

MitchellBerend commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Could I pick this up?

MitchellBerend commented 1 year ago

@SanchithHegde sure, im not working on it.