133 lines
3.9 KiB
Plaintext
Raw Normal View History

2021-05-04 05:03:23 +08:00
#compdef zoxide
autoload -U is-at-least
_zoxide() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
2021-05-04 05:03:23 +08:00
":: :_zoxide_commands" \
"*::: :->zoxide" \
&& ret=0
case $state in
(zoxide)
words=($line[1] "${words[@]}")
(( CURRENT += 1 ))
curcontext="${curcontext%:*:*}:zoxide-command-$line[1]:"
case $line[1] in
(add)
_arguments "${_arguments_options[@]}" \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*::paths:_files -/' \
2021-05-04 05:03:23 +08:00
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" \
2021-10-21 00:01:06 +05:30
'--from=[Application to import from]:FROM:(autojump z)' \
2021-05-04 05:03:23 +08:00
'--merge[Merge into existing database]' \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
2021-05-20 02:54:06 +05:30
':path:_files' \
2021-05-04 05:03:23 +08:00
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
2021-10-21 00:01:06 +05:30
'--cmd=[Renames the '\''z'\'' command and corresponding aliases]:CMD: ' \
'--hook=[Chooses event upon which an entry is added to the database]:HOOK:(none prompt pwd)' \
2021-05-04 05:03:23 +08:00
'--no-aliases[Prevents zoxide from defining any commands]' \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
2021-05-04 05:03:23 +08:00
':shell:(bash elvish fish nushell posix powershell xonsh zsh)' \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" \
2021-10-21 00:01:06 +05:30
'--exclude=[Exclude a path from results]:path:_files -/' \
2021-05-08 08:35:34 +05:30
'--all[Show deleted directories]' \
2021-05-04 05:03:23 +08:00
'(-l --list)-i[Use interactive selection]' \
'(-l --list)--interactive[Use interactive selection]' \
'(-i --interactive)-l[List all matching directories]' \
'(-i --interactive)--list[List all matching directories]' \
2021-06-01 08:59:24 +05:30
'(-i --interactive)-s[Print score with results]' \
'(-i --interactive)--score[Print score with results]' \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
2021-05-04 05:03:23 +08:00
'*::keywords:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
2021-12-24 17:49:36 +05:30
'-i[Use interactive selection]' \
'--interactive[Use interactive selection]' \
2021-08-15 17:26:56 +05:30
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
'*::paths:_files -/' \
2021-05-04 05:03:23 +08:00
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_zoxide_commands] )) ||
_zoxide_commands() {
local commands; commands=(
2021-08-15 17:26:56 +05:30
'add:Add a new directory or increment its rank' \
'import:Import entries from another application' \
'init:Generate shell configuration' \
'query:Search for a directory in the database' \
'remove:Remove a directory from the database' \
2021-05-04 05:03:23 +08:00
)
_describe -t commands 'zoxide commands' commands "$@"
}
(( $+functions[_zoxide__add_commands] )) ||
_zoxide__add_commands() {
2021-08-15 17:26:56 +05:30
local commands; commands=()
2021-05-04 05:03:23 +08:00
_describe -t commands 'zoxide add commands' commands "$@"
}
(( $+functions[_zoxide__import_commands] )) ||
_zoxide__import_commands() {
2021-08-15 17:26:56 +05:30
local commands; commands=()
2021-05-04 05:03:23 +08:00
_describe -t commands 'zoxide import commands' commands "$@"
}
(( $+functions[_zoxide__init_commands] )) ||
_zoxide__init_commands() {
2021-08-15 17:26:56 +05:30
local commands; commands=()
2021-05-04 05:03:23 +08:00
_describe -t commands 'zoxide init commands' commands "$@"
}
(( $+functions[_zoxide__query_commands] )) ||
_zoxide__query_commands() {
2021-08-15 17:26:56 +05:30
local commands; commands=()
2021-05-04 05:03:23 +08:00
_describe -t commands 'zoxide query commands' commands "$@"
}
(( $+functions[_zoxide__remove_commands] )) ||
_zoxide__remove_commands() {
2021-08-15 17:26:56 +05:30
local commands; commands=()
2021-05-04 05:03:23 +08:00
_describe -t commands 'zoxide remove commands' commands "$@"
}
_zoxide "$@"