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

Positional argument before "--" in usage #461

Closed
mbudde opened this issue Mar 27, 2016 · 2 comments
Closed

Positional argument before "--" in usage #461

mbudde opened this issue Mar 27, 2016 · 2 comments
Assignees
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies
Milestone

Comments

@mbudde
Copy link

mbudde commented Mar 27, 2016

extern crate clap;

use clap::{App};

fn main() {
    App::new("Clap test")
        .arg_from_usage("<INPUT>...")
        .get_matches();
}
$ target/debug/clap-test -h
Clap test

USAGE:
    clap-test [FLAGS] <INPUT>... [--]

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

ARGS:
    <INPUT>...    

I would expect usage to show clap-test [FLAGS] [--] <INPUT>....

@kbknapp
Copy link
Member

kbknapp commented Mar 27, 2016

Ah, thanks for filing this! It's a bug.

Actually in your example, the [--] shouldn't be there at all. The [--] only appears in the usage string when there are options which can accept multiple values, and positional arguments where aren't required. This is in order to prompt the user and potentially prevent something like

$ myprog --option val1 val2 "am I positional1 or val3?"

@kbknapp kbknapp added C-bug Category: Updating dependencies P2: need to have A-help Area: documentation, including docs.rs, readme, examples, etc... labels Mar 27, 2016
kbknapp added a commit that referenced this issue Mar 27, 2016
@kbknapp kbknapp self-assigned this Mar 27, 2016
@kbknapp kbknapp added this to the 2.2.2 milestone Mar 27, 2016
@kbknapp
Copy link
Member

kbknapp commented Mar 27, 2016

v2.2.2 on crates.io should have fixed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-help Area: documentation, including docs.rs, readme, examples, etc... C-bug Category: Updating dependencies
Projects
None yet
Development

No branches or pull requests

2 participants