mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
small tweak to alias.fish: always add some prefix if in danger of infinite recursion
This commit is contained in:
parent
e7c1cb7185
commit
2f43584727
1 changed files with 3 additions and 4 deletions
|
@ -36,15 +36,14 @@ function alias --description "Legacy function for creating shellscript functions
|
|||
end
|
||||
|
||||
|
||||
# If we are shadowing an existing (internal or external) command, set the
|
||||
# correct prefix. If $name is different from the command in $body, we assume
|
||||
# the user knows what he/she is doing.
|
||||
# Prevent the alias from immediately running into an infinite recursion if
|
||||
# $body starts with the same command as $name.
|
||||
|
||||
switch $body
|
||||
case $name $name\ \* $name\t\*
|
||||
if contains $name (builtin --names)
|
||||
set prefix builtin
|
||||
else if which $name >/dev/null
|
||||
else
|
||||
set prefix command
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue