mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-30 11:21:15 -03:00
argparse: Fix validation for short-only-flags
This read something like `o=!_validate_int`, and the flag modifier reading kept the pointer after the `!`, so it created a long flag called `_validate_int`, which meant it would not only error out form ```fish argparse 'i=!_validate_int' 'o=!_validate_int' -- $argv ``` with "Long flag '_validate_int' already defined", but also set $_flag_validate_int. Fixes #5864.
This commit is contained in:
@@ -181,6 +181,8 @@ static bool parse_flag_modifiers(const argparse_cmd_opts_t &opts, const option_s
|
||||
if (*s == L'!') {
|
||||
s++;
|
||||
opt_spec->validation_command = wcstring(s);
|
||||
// Move cursor to the end so we don't expect a long flag.
|
||||
while (*s) s++;
|
||||
} else if (*s) {
|
||||
streams.err.append_format(BUILTIN_ERR_INVALID_OPT_SPEC, opts.name.c_str(),
|
||||
option_spec.c_str(), *s);
|
||||
|
||||
Reference in New Issue
Block a user