mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
argparse: Fix --
regression
I was a tad overzealous there with not appending the remaining arguments. Weird that we didn't test it, though. Fixes #5857.
This commit is contained in:
parent
411b4aea9d
commit
e91eb85949
4 changed files with 17 additions and 4 deletions
|
@ -634,11 +634,9 @@ static int argparse_parse_args(argparse_cmd_opts_t &opts, const wcstring_list_t
|
||||||
retval = check_for_mutually_exclusive_flags(opts, streams);
|
retval = check_for_mutually_exclusive_flags(opts, streams);
|
||||||
if (retval != STATUS_CMD_OK) return retval;
|
if (retval != STATUS_CMD_OK) return retval;
|
||||||
|
|
||||||
if (opts.stop_nonopt) {
|
|
||||||
for (int i = optind; argv[i]; i++) {
|
for (int i = optind; argv[i]; i++) {
|
||||||
opts.argv.push_back(argv[i]);
|
opts.argv.push_back(argv[i]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_CMD_OK;
|
return STATUS_CMD_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,3 +118,6 @@ in function 'notargparse'
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Check for crash when last option is unknown
|
# Check for crash when last option is unknown
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Checking arguments after --
|
||||||
|
|
|
@ -189,3 +189,9 @@ echo $_flag_a
|
||||||
|
|
||||||
logmsg Check for crash when last option is unknown
|
logmsg Check for crash when last option is unknown
|
||||||
argparse -i b/break -- "-b kubectl get pods -l name=foo"
|
argparse -i b/break -- "-b kubectl get pods -l name=foo"
|
||||||
|
|
||||||
|
begin
|
||||||
|
logmsg Checking arguments after "--"
|
||||||
|
argparse a/alpha -- a --alpha -- b -a
|
||||||
|
printf '%s\n' $argv
|
||||||
|
end
|
||||||
|
|
|
@ -140,3 +140,9 @@ alpha aaaa
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Check for crash when last option is unknown
|
# Check for crash when last option is unknown
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Checking arguments after --
|
||||||
|
a
|
||||||
|
b
|
||||||
|
-a
|
||||||
|
|
Loading…
Reference in a new issue