zoxide/contrib/completions/zoxide.bash

225 lines
7.0 KiB
Bash
Raw Normal View History

2021-05-03 21:03:23 +00:00
_zoxide() {
local i cur prev opts cmd
2021-05-03 21:03:23 +00:00
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
2021-05-03 21:03:23 +00:00
cmd="zoxide"
;;
zoxide,add)
cmd="zoxide__add"
2021-05-03 21:03:23 +00:00
;;
2023-01-07 17:28:10 +00:00
zoxide,edit)
cmd="zoxide__edit"
;;
zoxide,import)
cmd="zoxide__import"
2021-05-03 21:03:23 +00:00
;;
zoxide,init)
cmd="zoxide__init"
2021-05-03 21:03:23 +00:00
;;
zoxide,query)
cmd="zoxide__query"
2021-05-03 21:03:23 +00:00
;;
zoxide,remove)
cmd="zoxide__remove"
2021-05-03 21:03:23 +00:00
;;
2023-01-07 17:28:10 +00:00
zoxide__edit,decrement)
cmd="zoxide__edit__decrement"
;;
zoxide__edit,delete)
cmd="zoxide__edit__delete"
;;
zoxide__edit,increment)
cmd="zoxide__edit__increment"
;;
zoxide__edit,reload)
cmd="zoxide__edit__reload"
;;
2021-05-03 21:03:23 +00:00
*)
;;
esac
done
case "${cmd}" in
zoxide)
2023-01-07 17:28:10 +00:00
opts="-h -V --help --version add edit import init query remove"
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__add)
2021-10-20 18:31:06 +00:00
opts="-h -V --help --version <PATHS>..."
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
2023-01-07 17:28:10 +00:00
zoxide__edit)
opts="-h -V --help --version decrement delete increment reload"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__edit__decrement)
opts="-h -V --help --version <PATH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__edit__delete)
opts="-h -V --help --version <PATH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__edit__increment)
opts="-h -V --help --version <PATH>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__edit__reload)
opts="-h -V --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
2021-05-03 21:03:23 +00:00
zoxide__import)
2021-10-20 18:31:06 +00:00
opts="-h -V --from --merge --help --version <PATH>"
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--from)
2022-05-19 11:07:25 +00:00
COMPREPLY=($(compgen -W "autojump z" -- "${cur}"))
2021-05-03 21:03:23 +00:00
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__init)
2022-04-10 22:11:51 +00:00
opts="-h -V --no-cmd --cmd --hook --help --version bash elvish fish nushell posix powershell xonsh zsh"
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--cmd)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--hook)
2022-05-19 11:07:25 +00:00
COMPREPLY=($(compgen -W "none prompt pwd" -- "${cur}"))
2021-05-03 21:03:23 +00:00
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__query)
opts="-i -l -s -h -V --all --interactive --list --score --exclude --help --version [KEYWORDS]..."
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--exclude)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
zoxide__remove)
2023-01-07 17:28:10 +00:00
opts="-h -V --help --version [PATHS]..."
2021-05-03 21:03:23 +00:00
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _zoxide -o bashdefault -o default zoxide