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

use -V for version instead of -v #138

Closed
kbknapp opened this issue Jun 7, 2015 · 5 comments
Closed

use -V for version instead of -v #138

kbknapp opened this issue Jun 7, 2015 · 5 comments
Assignees
Labels
M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-decision Status: Waiting on a go/no-go before implementing
Milestone

Comments

@kbknapp
Copy link
Member

kbknapp commented Jun 7, 2015

In order to follow typical conventions where lowercase -v is for verbose and many programs use the capital -V for version (to include rustc). Currently, if one wants to use typical -v for verbose, that leaves only the long for version with no option to "add" a short without manually implementing it (which isn't hard...but still).

There are two options for this:

  1. Simply change default short of version to -V which is a "breaking" change (at least for downstream documentation).
  2. Use short -v for version unless manually overridden, then use short -V if available.

I like option 2 because it's a non-breaking change, the downside is it could be confusing if a program suddenly changes from -v to -V for version seemingly automagically. Or when subcommands have one -v but parents or other subcommands have -V....so maybe I actually prefer option 1.

TBD

@kbknapp kbknapp added M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-decision Status: Waiting on a go/no-go before implementing labels Jun 7, 2015
@kbknapp kbknapp self-assigned this Jun 7, 2015
@kbknapp kbknapp added this to the 1.0 Release milestone Jun 7, 2015
@kbknapp
Copy link
Member Author

kbknapp commented Jun 17, 2015

-V is now the default. In order to stay more in line with other standard command line interfaces.

I have added App::version_short() and App::help_short() which allow you to override this default (and set it to anything you like).

@JimLynchCodes
Copy link

JimLynchCodes commented May 21, 2023

@kbknapp honestly, I don't like this change.

Many popular cli tools (for example, npm) use the lower case -v for the version short flag.

The App::version_short() is cool, but I'm still not sure how to actually use it with the Clap derive syntax... also, what if you want to allow both -v and -V for short version flag?

@epage
Copy link
Member

epage commented May 22, 2023

imo -v is more generally recognized as --verbose and we do allow customizing it, so not too concerned about some tools using -v for --version.

App::version_short was more of a v2 way of customizing it.

The way to do this in clap today is something like:

#[derive(Parser)]
#[command(disable_version_flag = true)]
struct {
    /// Print version
    #[arg(short = 'v', short_alias = 'V', long, action = clap::builder::ArgAction::Version)]
    version: (),
}

@fawdlstty
Copy link

Can we change the version retrieval method to lowercase? Verbose is not something everyone needs, but uppercase input is difficult, using lowercase to obtain the version is more reasonable

@epage
Copy link
Member

epage commented Jan 31, 2024

At this point, someone would need to put forward a strong case for changing the default. As shown above, people are free to change this for their application as they wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M-breaking-change Meta: Implementing or merging this will introduce a breaking change. S-waiting-on-decision Status: Waiting on a go/no-go before implementing
Projects
None yet
Development

No branches or pull requests

4 participants