You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With an executable taking a top level required argument "foo", and a subcommand "bar", displaying bar's help with ./clap-test bar --help should display the help like this:
$ ./target/debug/clap-test bar --help
clap-test-bar
bar
USAGE:
clap-test bar --baz <baz>
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--baz <baz> baz
Actual Behavior Summary
$ ./target/debug/clap-test bar --help
error: The following required arguments were not provided:
--foo <FILE>
USAGE:
clap-test --foo <FILE> [SUBCOMMAND]
For more information try --help
Steps to Reproduce the issue
Build and run the attached code
Sample Code or Link to Sample Code
#[macro_use]externcrate clap;use clap::{App,Arg,SubCommand};fnmain(){let matches = App::new("test").version(crate_version!()).arg(Arg::with_name("foo").long("foo").value_name("FILE").help("Sets a custom config file").takes_value(true).required(true)).subcommand(SubCommand::with_name("bar").about("bar").arg(Arg::with_name("baz").long("baz").takes_value(true).required(true).help("baz"))).get_matches();}
Debug output
$ ./target/debug/clap-test bar --help
*DEBUG:clap: fn=Parser::add_subcommand;
*DEBUG:clap: Term width...None
*DEBUG:clap: Is help...No
*DEBUG:clap: VersionlessSubcommands set...false
*DEBUG:clap: GlobalVersion set...false
*DEBUG:clap: fn=get_matches_with;
*DEBUG:clap: fn=create_help_and_version;
*DEBUG:clap: Building --help
*DEBUG:clap: Building --version
*DEBUG:clap: Building help
*DEBUG:clap: Begin parsing '"bar"' ([98, 97, 114])
*DEBUG:clap: fn=check_is_new_arg;nvo=None
*DEBUG:clap: Does arg allow leading hyphen...false
*DEBUG:clap: Starts new arg...Probable value
*DEBUG:clap: Starts new arg...false
*DEBUG:clap: fn=possible_subcommand
*DEBUG:clap: fn=validate_blacklist;blacklist=[]
*DEBUG:clap: fn=validate_num_args;
*DEBUG:clap: fn=create_usage;
*DEBUG:clap: fn=create_usage_no_title;
*DEBUG:clap: args_in_groups=[]
*DEBUG:clap: fn=fmt
*DEBUG:clap: fn=needs_flags_tag;
*DEBUG:clap: iter;f=hclap_help;
*DEBUG:clap: iter;f=vclap_version;
*DEBUG:clap: fn=validate_required;required=["foo"];
*DEBUG:clap: iter;name=foo
*DEBUG:clap: fn=is_missing_required_ok;a=foo
*DEBUG:clap: args_in_groups=[]
*DEBUG:clap: fn=fmt
*DEBUG:clap: fn=create_usage;
*DEBUG:clap: fn=create_usage_no_title;
*DEBUG:clap: args_in_groups=[]
*DEBUG:clap: fn=fmt
*DEBUG:clap: fn=needs_flags_tag;
*DEBUG:clap: iter;f=hclap_help;
*DEBUG:clap: iter;f=vclap_version;
*DEBUG:clap: fn=color;
*DEBUG:clap: Color setting...Auto
*DEBUG:clap: fn=error;
*DEBUG:clap: fn=is_a_tty;
*DEBUG:clap: Use stderr...true
*DEBUG:clap: fn=good;
*DEBUG:clap: fn=is_a_tty;
*DEBUG:clap: Use stderr...true
error: The following required arguments were not provided:
--foo <FILE>
USAGE:
clap-test --foo <FILE> [SUBCOMMAND]
For more information try --help
The text was updated successfully, but these errors were encountered:
Rust Version
rustc 1.15.0-nightly (2217bd771 2016-11-25)
Affected Version of clap
2.19.2
Expected Behavior Summary
With an executable taking a top level required argument "foo", and a subcommand "bar", displaying bar's help with
./clap-test bar --help
should display the help like this:Actual Behavior Summary
Steps to Reproduce the issue
Build and run the attached code
Sample Code or Link to Sample Code
Debug output
The text was updated successfully, but these errors were encountered: