-
Notifications
You must be signed in to change notification settings - Fork 107
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
Upgrade to clap 4 #263
Upgrade to clap 4 #263
Conversation
36c9679
to
b262298
Compare
@@ -17,7 +17,7 @@ tempfile = "3.3" | |||
xdg = "2.4" | |||
|
|||
[dependencies] | |||
clap = { version = "3.2", features = ["cargo"] } | |||
clap = { version = "4.0", features = ["cargo"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nit, but it might be worth considering bumping to the latest minor here (4.0.9
), since they had a couple of bug fixes since 4.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have very mixed feelings about this. But the way I have been leaning lately is to not include patch versions in Cargo.toml files. Tracking patch versions tends to introduce a lot of noise, and I prefer changes to the Cargo.toml file to be "significant," e.g., addition/removal of a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this was based on a misunderstanding on my part. This is good to ignore.
.subcommand_required(true) | ||
.arg_required_else_help(true) | ||
.allow_external_subcommands(true) | ||
.external_subcommand_value_parser(value_parser!(OsString)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I think this is the default value parser for external subcommands, so you can probably omit this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My experiments support this.
However, I think I would prefer keep this line. If someone later reviews this change, I would like it to be clear that this line was not lost:
Line 112 in 3cba662
.setting(AllowInvalidUtf8ForExternalSubcommands) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense!
.allow_hyphen_values(true) | ||
.disable_help_subcommand(true) | ||
.disable_help_flag(true) | ||
.disable_version_flag(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be tested, but I believe subcommands now have their version flags disabled by default. So you might no longer need this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Ditto for all other subcommands.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added several tests. Please tell me if you think there are still gaps, or if you do not like their approach(es).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking a look now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Those tests are great!
Thanks a million, @woodruffw. |
No description provided.