Skip to content

Conversation

@donnywdavis
Copy link

I'm sure that this could be considered a personal preference, but wanted to submit to see what others think.

When checking for the version number of a cli I always assume that -v is available as a short name and try that before --version. However, using the built in version property on CommandConfiguration only enables the long format of --version. If we want to enable -v then we have to implement our own version flag and ignore the property in the configuration.

This is just a small change to make -v available as a short name for the version flag.

OPTIONS:
  -v, --version           Show the version.
  -h, --help              Show help information.

If we wanted to make this more flexible then we could extend CommandConfiguration to also accept a NameSpecification for the version. I just went with the simplest approach for now.

I also understand that an argument could be made that this would conflict with a flag called verbose. Someone may want to use -v as the short name for that. By making -v available in CommandConfiguration it removes the option when having both of these flags in a single command. I feel like having the version number is more common than having a flag called verbose, so I personally wouldn't consider it a blocker as the verbose flag could just use the long name or a different custom short name. Just my opinion. Curious what y'all think.

Checklist

  • I've added at least one test that validates that my change is working, if appropriate
  • I've followed the code style of the rest of the project
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary

@rauhul
Copy link
Contributor

rauhul commented Jan 15, 2026

I think this overlaps too much with using -v for --verbose @natecook1000 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants