Fix error for "fish --foo" without option argument

Wgetopt needs a ":" at the beginning to turn on this type of error.

I'm not sure why that is now, and we might want to change it (but tbh
wgetopt could do with a replacement anyway).

Fixes #11049
This commit is contained in:
Fabian Boehm 2025-01-17 09:52:53 +01:00
parent ba4ead6ead
commit fb2caf63e5
2 changed files with 4 additions and 1 deletions

View File

@ -528,7 +528,7 @@ fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow<i
const PRINT_DEBUG_CATEGORIES_ARG: char = 2 as char;
const PROFILE_STARTUP_ARG: char = 3 as char;
const SHORT_OPTS: &wstr = L!("+hPilNnvc:C:p:d:f:D:o:");
const SHORT_OPTS: &wstr = L!("+:hPilNnvc:C:p:d:f:D:o:");
const LONG_OPTS: &[WOption<'static>] = &[
wopt(L!("command"), RequiredArgument, 'c'),
wopt(L!("init-command"), RequiredArgument, 'C'),

View File

@ -111,5 +111,8 @@ $fish --no-config -c 'echo notprinted | and true'
# CHECKERR: echo notprinted | and true
# CHECKERR: ^~^
$fish --no-config --features
# CHECKERR: fish: --features: option requires an argument
# Regression test for a hang.
echo "set -L" | $fish > /dev/null