fix: Check for real optional arguments

This commit is contained in:
Lzu Tao 2024-07-06 17:45:12 +00:00
parent e276fc420b
commit 1dd1056cd7
2 changed files with 7 additions and 2 deletions

View file

@ -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('=');
}
}

View file

@ -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