formatted apm completion and used helper function
parent
2c39053879
commit
f71d76990a
|
|
@ -24,7 +24,9 @@
|
||||||
|
|
||||||
# repo: https://github.com/vigo/apm-bash-completion
|
# repo: https://github.com/vigo/apm-bash-completion
|
||||||
|
|
||||||
__apm(){
|
if _command_exists apm
|
||||||
|
then
|
||||||
|
function __apm(){
|
||||||
local cur prev options apm_command
|
local cur prev options apm_command
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
|
@ -51,7 +53,8 @@ __apm(){
|
||||||
fi
|
fi
|
||||||
COMPREPLY=($(compgen -W "$options" -- "$cur"))
|
COMPREPLY=($(compgen -W "$options" -- "$cur"))
|
||||||
}
|
}
|
||||||
__apm_get_command() {
|
|
||||||
|
function __apm_get_command() {
|
||||||
local i
|
local i
|
||||||
for ((i=1; i < $COMP_CWORD; ++i)); do
|
for ((i=1; i < $COMP_CWORD; ++i)); do
|
||||||
local arg=${COMP_WORDS[$i]}
|
local arg=${COMP_WORDS[$i]}
|
||||||
|
|
@ -74,4 +77,6 @@ __apm_get_command() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -F __apm -o bashdefault -o default apm
|
complete -F __apm -o bashdefault -o default apm
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue