-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Description
Fish Version: 3.4.0
OS Version: Linux 5.4.0-104-generic #118~18.04.1-Ubuntu SMP Thu Mar 3 13:53:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
TERM: xterm-256color
I've tried fish without any third-party customizations by executing:
sh -c 'env HOME=$(mktemp -d) fish'And running the following:
username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFuncExpected behavior
username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFunc
username@host /h/username>Actual behavior
username@host /h/username> function testFunc; echo "Test"; end; funcsave -q testFunc
funcsave: wrote /tmp/tmp.Jhyt5f19Lo/.config/fish/functions/testFunc.fish
username@host /h/username>The actual behavior is synonymous to running the command without the -q flag.
Reasoning
I believe this is a small-ish bug, the 3.4.0 version of funcsave incorrectly defines/checks the -q flag. That is, line 2 defines the opt as just q, while line 32 checks for _flag_quiet.
Per the argparse documentation for 3.4.0
x means that only -x is valid. It is a boolean that can be used more than once. If it is seen then _flag_x will be set to the count of how many times the flag was seen.
So either funcsave needs to declare q/quiet for the opts, or check _flag_q instead.
I've tested it by editing the funcsave.fish in my /usr/share/fish/functions/funcsave.fish to have q/quiet and the behavior was fixed.