mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 17:55:50 +08:00
Fix abbr return status
This was supposed to act like `type -q` or `command -q`, in that it returns 0 if at least 1 exists. But because it used the wrong variable it didn't. Fixes #8431.
This commit is contained in:
parent
aa470e12b2
commit
c16e30931b
|
@ -59,7 +59,7 @@ function abbr --description "Manage abbreviations"
|
|||
# We return 0 if any arg exists, whereas `set -q` returns the number of undefined arguments.
|
||||
# But we should be consistent with `type -q` and `command -q`.
|
||||
for var in $escaped
|
||||
set -q $escaped; and return 0
|
||||
set -q $var; and return 0
|
||||
end
|
||||
return 1
|
||||
else
|
||||
|
|
|
@ -94,3 +94,15 @@ abbr --add --global __abbr14 bbbbbbbbbbbbb
|
|||
abbr --erase __abbr13 __abbr14
|
||||
abbr | grep __abbr13
|
||||
abbr | grep __abbr14
|
||||
|
||||
abbr -q banana
|
||||
echo $status
|
||||
# CHECK: 1
|
||||
|
||||
abbr -q __abbr8 banana
|
||||
echo $status
|
||||
# CHECK: 0
|
||||
|
||||
abbr -q banana __abbr8 foobar
|
||||
echo $status
|
||||
# CHECK: 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user