mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-09 12:11:20 -03:00
alias: don't add --wraps for wrappers with the same name
These aliases seem to be common, see #7389 and others. This prevents recursion on that example, so `alias ssh "env TERM=screen ssh"` will just have the same completions as ssh. Checking the last token is a heuristic which hopefully works for most cases. Users are encouraged to use functions instead of aliases.
This commit is contained in:
@@ -31,3 +31,19 @@ functions d
|
||||
# CHECK: function d --wraps=\'/mnt/c/Program\ Files\ \(x86\)/devenv.exe\'\ /Edit --description alias\ d\ \'/mnt/c/Program\ Files\ \(x86\)/devenv.exe\'\ /Edit
|
||||
# CHECK: '/mnt/c/Program Files (x86)/devenv.exe' /Edit $argv;
|
||||
# CHECK: end
|
||||
|
||||
# Use "command" to prevent recusion, and don't add --wraps to avoid accidental recursion in completion.
|
||||
alias e 'e --option=value'
|
||||
functions e
|
||||
# CHECK: # Defined in - @ line 1
|
||||
# CHECK: function e --description 'alias e e --option=value'
|
||||
# CHECK: command e --option=value $argv;
|
||||
# CHECK: end
|
||||
|
||||
# Don't add --wraps if it looks like a wrapper command to avoid accidental recursion in completion.
|
||||
alias f 'wrapper around f'
|
||||
functions f
|
||||
# CHECK: # Defined in - @ line 1
|
||||
# CHECK: function f --description 'alias f wrapper around f'
|
||||
# CHECK: wrapper around f $argv;
|
||||
# CHECK: end
|
||||
|
||||
Reference in New Issue
Block a user