mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2024-11-27 10:49:55 +08:00
[split] Move balias plugin to oh-my-fish/plugin-balias
https://github.com/oh-my-fish/plugin-balias
This commit is contained in:
parent
b2549c2005
commit
1963af4cb0
|
@ -1,16 +0,0 @@
|
|||
# A better alias provide completion
|
||||
|
||||
Use `balias` instead of `alias`,you can get same completion meanwhile you set alias.
|
||||
|
||||
# Example
|
||||
|
||||
```
|
||||
balias apti 'sudo apt-get install'
|
||||
balias gc 'git checkout'
|
||||
```
|
||||
|
||||
Then,you will get
|
||||
|
||||
![apti](http://www.geekpics.net/images/2014/08/23/TJn6kfBY.png)
|
||||
|
||||
![gc](http://www.geekpics.net/images/2014/08/23/655x76xcPJolvxqra.png.pagespeed.ic.4S9hgPfZ53.png)
|
|
@ -1,10 +0,0 @@
|
|||
function balias --argument alias command
|
||||
eval 'alias $alias $command'
|
||||
if expr $command : '^sudo '>/dev/null
|
||||
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
|
|
@ -1,36 +0,0 @@
|
|||
import plugins/fish-spec
|
||||
import plugins/balias
|
||||
|
||||
function describe_library -d "balias: better-alias"
|
||||
|
||||
function after_all
|
||||
functions -e changedir
|
||||
functions -e ls_as_root
|
||||
end
|
||||
|
||||
function it_doesnt_fail
|
||||
balias changedir cd
|
||||
expect $status --to-equal 0
|
||||
end
|
||||
|
||||
function it_defines_an_alias
|
||||
balias changedir cd
|
||||
set -l ignore_output (functions changedir)
|
||||
expect $status --to-equal 0
|
||||
end
|
||||
|
||||
function you_can_use_the_alias
|
||||
mkdir testdir
|
||||
changedir testdir
|
||||
expect test $status --to-be-true
|
||||
cd ..
|
||||
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