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

Inconsistent on inferring Help/Version action #4057

Closed
epage opened this issue Aug 11, 2022 · 1 comment · Fixed by #4059
Closed

Inconsistent on inferring Help/Version action #4057

epage opened this issue Aug 11, 2022 · 1 comment · Fixed by #4059
Labels
A-builder Area: Builder API A-derive Area: #[derive]` macro API C-bug Category: Updating dependencies S-waiting-on-decision Status: Waiting on a go/no-go before implementing
Milestone

Comments

@epage
Copy link
Member

epage commented Aug 11, 2022

As of at least #4056 in master,

  • arg!(--help) will implicitly get ArgAction::Help
  • Arg::new("help").long("help") will implicitly get ArgAction::Help
  • #[clap(long)] help: bool will implicitly get ArgAction::SetTrue

Questions

  • Should these all be consistent?
  • Which direction should these all go?

Considerations

@epage epage added C-bug Category: Updating dependencies S-waiting-on-decision Status: Waiting on a go/no-go before implementing A-builder Area: Builder API A-derive Area: #[derive]` macro API labels Aug 11, 2022
@epage epage added this to the 4.0 milestone Aug 11, 2022
@epage
Copy link
Member Author

epage commented Aug 11, 2022

For derive, I played with a field type of () with help/version ids causing it to infer the action.

Overall, I'm concerned with the magic / documentation for any exceptions to inferring like this. I'm tempted to create tests to verify the workflow and to ensure that the experience isn't terrible and to remove all special casing.

epage added a commit to epage/clap that referenced this issue Aug 11, 2022
This will make it easier for people to override these

Fixes clap-rs#4057
epage added a commit to epage/clap that referenced this issue Aug 11, 2022
Documenting the existing behavior is challenging which suggests it can
cause user confusion.  So long as its not too hard to explicitly
specify actions, we should just do it.

Fixes clap-rs#4057
epage added a commit to epage/clap that referenced this issue Aug 11, 2022
Documenting the existing behavior is challenging which suggests it can
cause user confusion.  So long as its not too hard to explicitly
specify actions, we should just do it.

Fixes clap-rs#4057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builder Area: Builder API A-derive Area: #[derive]` macro API C-bug Category: Updating dependencies S-waiting-on-decision Status: Waiting on a go/no-go before implementing
Projects
None yet
1 participant