fix for sudo command aliases

pull/2/head
Dave Yarwood 10 years ago
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…
Cancel
Save