8000 `funcsave -q` is not actually quiet · Issue #8830 · fish-shell/fish-shell · GitHub
[go: up one dir, main page]

Skip to content

funcsave -q is not actually quiet #8830

@anhnamtran

Description

@anhnamtran

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 testFunc

Expected 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionSomething that used to work, but was broken, especially between releases

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0