mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-27 02:34:13 +08:00
fix for sudo command aliases
This commit is contained in:
parent
849fcbecc8
commit
14902584f5
|
@ -1,11 +1,10 @@
|
|||
function balias --argument alias command
|
||||
eval 'alias $alias $command'
|
||||
if expr $command : '^sudo '>/dev/null
|
||||
set command (expr substr + $command 6 (expr length $command))
|
||||
set command (echo "$command" | cut -c6-)
|
||||
end
|
||||
complete -c $alias -xa "(
|
||||
set -l cmd (commandline -pc | sed -e 's/^ *\S\+ *//' );
|
||||
complete -C\"$command \$cmd\";
|
||||
)"
|
||||
end
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ function describe_library -d "better-alias"
|
|||
|
||||
function after_all
|
||||
functions -e changedir
|
||||
functions -e ls_as_root
|
||||
end
|
||||
|
||||
function it_doesnt_fail
|
||||
|
@ -25,6 +26,11 @@ function describe_library -d "better-alias"
|
|||
rmdir testdir
|
||||
end
|
||||
|
||||
function it_chops_off_sudo
|
||||
balias ls_as_root 'sudo ls'
|
||||
expect test $status --to-be-true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
spec.run $argv
|
Loading…
Reference in New Issue
Block a user