Add auto-completion for config command
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3ed7de4a5d
commit
12c3ebc1d6
2 changed files with 29 additions and 0 deletions
25
.zsh/complete/_config
Normal file
25
.zsh/complete/_config
Normal file
|
@ -0,0 +1,25 @@
|
|||
#compdef _config config
|
||||
set -eo pipefail
|
||||
|
||||
typeset -A opt_args
|
||||
|
||||
function _config() {
|
||||
#set -x
|
||||
_arguments -C \
|
||||
'1:repo:->repos' \
|
||||
'*::: :->args'
|
||||
|
||||
case "$state" in
|
||||
repos)
|
||||
local repos
|
||||
repos=($(ls -1 "${HOME}/.cfg"))
|
||||
_describe 'repos' repos
|
||||
;;
|
||||
args)
|
||||
_dispatch git -default-
|
||||
;;
|
||||
*)
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
}
|
|
@ -59,3 +59,7 @@ source ${HOME}/.zsh/peco.sh
|
|||
|
||||
## Clean PATH from duplicates
|
||||
export PATH=$(${HOME}/bin/path-dedup.py)
|
||||
|
||||
## Add custom auto-completions
|
||||
export fpath=("${HOME}/.zsh/complete" $fpath)
|
||||
compinit
|
||||
|
|
Loading…
Reference in a new issue