fix(cache): allow --help flag for cache subcommand#3580
fix(cache): allow --help flag for cache subcommand#3580keith-hall merged 9 commits intosharkdp:masterfrom
Conversation
|
The This affects all PRs until the upstream dependency is updated in the main branch. |
keith-hall
left a comment
There was a problem hiding this comment.
Looks like the cache_help_shows_help_message integration test from the original PR got omitted?
There was a problem hiding this comment.
erm, the changelog entry being repeated for every version of bat ever released is a bit... odd... we can't go back in time / backport the fix and republish old versions with the same version number it originally had... I suggest just to keep the entry in the unreleased section...
|
Fixed both issues:
Thanks for catching these! |
|
Updated the fix to match the approach from #3573:
Just removing |
|
Found the root cause of the test failure: the parent command sets Added |
Summary
Fixes #3560
Problem
bat cache --helpcurrently fails with:This happens because the
cache-actionsArgGroup is set torequired(true), which causes clap to validate required arguments before processing the--helpflag.Solution
Remove
.required(true)from thecache-actionsArgGroup. The behavior remains the same (users must specify either--buildor--clearwhen running the cache subcommand) because clap will still show an error if neither is provided. However, now--helpis processed first, allowing users to view the help message.Testing
This is a resubmission of #3573 with
cargo fmtapplied.