mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-07 20:31:01 -05:00
Match style
This commit is contained in:
parent
2099355ad5
commit
4e79ba15f7
1 changed files with 26 additions and 31 deletions
|
@ -1,41 +1,36 @@
|
||||||
_commands()
|
_commands() {
|
||||||
{
|
local cur commands
|
||||||
local cur commands
|
COMPREPLY=()
|
||||||
COMPREPLY=()
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
commands="exec prefix rehash set-default set-local version versions\
|
||||||
commands="exec prefix rehash set-default set-local version versions\
|
whence which"
|
||||||
whence which"
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "${commands}" -- ${cur} ) )
|
COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
_rubies()
|
_rubies() {
|
||||||
{
|
local cur rubies
|
||||||
local cur rubies
|
local ROOT="${HOME}/.rbenv/versions"
|
||||||
local ROOT=$HOME/.rbenv/versions
|
COMPREPLY=()
|
||||||
COMPREPLY=()
|
cur=${COMP_WORDS[COMP_CWORD]}
|
||||||
cur=${COMP_WORDS[COMP_CWORD]}
|
rubies=($ROOT/*)
|
||||||
rubies=($ROOT/*)
|
# remove all but the final part of the name
|
||||||
# remove all but the final part of the name
|
rubies="${rubies[@]##*/}"
|
||||||
rubies="${rubies[@]##*/}"
|
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "${rubies}" -- ${cur} ) )
|
COMPREPLY=( $( compgen -W "$rubies" -- $cur ) )
|
||||||
}
|
}
|
||||||
|
|
||||||
_rbenv()
|
_rbenv() {
|
||||||
{
|
local cur prev
|
||||||
local cur prev
|
COMPREPLY=()
|
||||||
COMPREPLY=()
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
|
||||||
|
|
||||||
if [[ "${prev}" == set-default ]]; then
|
if [ "$prev" = "set-default" ]; then
|
||||||
_rubies
|
_rubies
|
||||||
else
|
else
|
||||||
_commands
|
_commands
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F _rbenv rbenv
|
complete -F _rbenv rbenv
|
||||||
|
|
||||||
# vim: set ts=4 sw=4 tw=75 filetype=sh:
|
|
Loading…
Reference in a new issue