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:
Fabian Homborg
2019-05-03 16:20:40 +02:00
parent 411b4aea9d
commit e91eb85949
4 changed files with 17 additions and 4 deletions

View File

@@ -634,10 +634,8 @@ static int argparse_parse_args(argparse_cmd_opts_t &opts, const wcstring_list_t
retval = check_for_mutually_exclusive_flags(opts, streams);
if (retval != STATUS_CMD_OK) return retval;
if (opts.stop_nonopt) {
for (int i = optind; argv[i]; i++) {
opts.argv.push_back(argv[i]);
}
for (int i = optind; argv[i]; i++) {
opts.argv.push_back(argv[i]);
}
return STATUS_CMD_OK;