mirror of
https://github.com/clap-rs/clap
synced 2024-11-10 06:44:16 +00:00
fix: Check for real optional arguments
This commit is contained in:
parent
e276fc420b
commit
1dd1056cd7
2 changed files with 7 additions and 2 deletions
|
@ -231,7 +231,12 @@ fn gen_subcommand_helpers(
|
|||
}
|
||||
optspecs.push_str(&escape_string(long, false));
|
||||
}
|
||||
if option.is_required_set() {
|
||||
|
||||
let is_an_option = option
|
||||
.get_num_args()
|
||||
.map(|r| r.takes_values())
|
||||
.unwrap_or(true);
|
||||
if is_an_option {
|
||||
optspecs.push('=');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Print an optspec for argparse to handle cmd's options that are independent of any subcommand.
|
||||
function __fish_exhaustive_global_optspecs
|
||||
string join \n global generate h/help V/version
|
||||
string join \n global generate= h/help V/version
|
||||
end
|
||||
|
||||
function __fish_exhaustive_needs_command
|
||||
|
|
Loading…
Reference in a new issue