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

Versionless subcommand setting does not take effect #329

Closed
jimmycuadra opened this issue Oct 28, 2015 · 5 comments
Closed

Versionless subcommand setting does not take effect #329

jimmycuadra opened this issue Oct 28, 2015 · 5 comments
Assignees
Labels
A-builder Area: Builder API C-enhancement Category: Raise on the bar on expectations
Milestone

Comments

@jimmycuadra
Copy link
Contributor

AppSetting::VersionlessSubCommands doesn't seem to disable the -V/--version options on subcommands as the docs describe:

extern crate clap;

use clap::{App, AppSettings, SubCommand};

fn main() {
    let matches = App::new("example")
        .setting(AppSettings::VersionlessSubcommands)
        .version(env!("CARGO_PKG_VERSION"))
        .subcommand(
            SubCommand::with_name("sub")
        )
        .get_matches();
}

Example executions:

$ prog -V
prog 0.1.0
$ prog sub -V
prog-sub
$ prog sub -h
prog-sub

USAGE:
    prog sub [FLAGS]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

Using clap 1.4.5 and Rust 1.3 on OS X.

@kbknapp
Copy link
Member

kbknapp commented Oct 29, 2015

Ah, that's actually an oversight in logic on our behalf. It's working as designed, but the design if flawed 😄

AppSettings::VersionlessSubcommands merely disables inheriting the parent command's version number...but you're correct it should also disable the -V, --version flags.

Thanks! 👍

@kbknapp kbknapp added C-enhancement Category: Raise on the bar on expectations A-builder Area: Builder API D: easy labels Oct 29, 2015
@kbknapp kbknapp self-assigned this Oct 29, 2015
@kbknapp kbknapp added this to the 1.4.6 milestone Oct 29, 2015
@kbknapp
Copy link
Member

kbknapp commented Oct 29, 2015

#330 fixes this. Once this merges, I'll put 1.4.6 out on crates.io 😉

@kbknapp
Copy link
Member

kbknapp commented Oct 29, 2015

v1.4.6 is out on crates.io

@jimmycuadra
Copy link
Contributor Author

Looks like the changelog needs to be regenerated. Thanks for the fixes this week! I love clap.

@kbknapp
Copy link
Member

kbknapp commented Oct 29, 2015

That's just because homu hasn't merged #331 yet, once that's done it should be updated. Thanks again for filing the bug reports! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-builder Area: Builder API C-enhancement Category: Raise on the bar on expectations
Projects
None yet
Development

No branches or pull requests

2 participants