2021-05-03 21:03:23 +00: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[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-05-03 21:03:23 +00: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[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-07-29 03:50:40 +00:00
|
|
|
'*::paths:_files -/' \
|
2021-05-03 21:03:23 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
2023-01-07 17:28:10 +00:00
|
|
|
(edit)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2023-01-07 17:28:10 +00:00
|
|
|
":: :_zoxide__edit_commands" \
|
|
|
|
"*::: :->edit" \
|
|
|
|
&& ret=0
|
|
|
|
|
|
|
|
case $state in
|
|
|
|
(edit)
|
|
|
|
words=($line[1] "${words[@]}")
|
|
|
|
(( CURRENT += 1 ))
|
|
|
|
curcontext="${curcontext%:*:*}:zoxide-edit-command-$line[1]:"
|
|
|
|
case $line[1] in
|
|
|
|
(decrement)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2023-01-07 17:28:10 +00:00
|
|
|
':path:' \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(delete)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2023-01-07 17:28:10 +00:00
|
|
|
':path:' \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(increment)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2023-01-07 17:28:10 +00:00
|
|
|
':path:' \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(reload)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2023-01-07 17:28:10 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2021-05-03 21:03:23 +00:00
|
|
|
(import)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2021-10-20 18:31:06 +00:00
|
|
|
'--from=[Application to import from]:FROM:(autojump z)' \
|
2021-05-03 21:03:23 +00:00
|
|
|
'--merge[Merge into existing database]' \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-05-19 21:24:06 +00:00
|
|
|
':path:_files' \
|
2021-05-03 21:03:23 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(init)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-05-05 21:46:13 +00:00
|
|
|
'--cmd=[Changes the prefix of the \`z\` and \`zi\` commands]:CMD: ' \
|
2022-04-10 22:11:51 +00:00
|
|
|
'--hook=[Changes how often zoxide increments a directory'\''s score]:HOOK:(none prompt pwd)' \
|
2023-05-05 21:46:13 +00:00
|
|
|
'--no-cmd[Prevents zoxide from defining the \`z\` and \`zi\` commands]' \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-05-03 21:03:23 +00:00
|
|
|
':shell:(bash elvish fish nushell posix powershell xonsh zsh)' \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(query)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-01-09 10:25:33 +00:00
|
|
|
'--exclude=[Exclude the current directory]:path:_files -/' \
|
2021-05-08 03:05:34 +00:00
|
|
|
'--all[Show deleted directories]' \
|
2021-05-03 21:03:23 +00: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]' \
|
2022-04-13 11:33:06 +00:00
|
|
|
'-s[Print score with results]' \
|
|
|
|
'--score[Print score with results]' \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-05-03 21:03:23 +00:00
|
|
|
'*::keywords:' \
|
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
(remove)
|
|
|
|
_arguments "${_arguments_options[@]}" \
|
2023-04-14 20:35:48 +00:00
|
|
|
'-h[Print help]' \
|
|
|
|
'--help[Print help]' \
|
|
|
|
'-V[Print version]' \
|
|
|
|
'--version[Print version]' \
|
2021-07-29 03:50:40 +00:00
|
|
|
'*::paths:_files -/' \
|
2021-05-03 21:03:23 +00:00
|
|
|
&& ret=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
|
|
|
(( $+functions[_zoxide_commands] )) ||
|
|
|
|
_zoxide_commands() {
|
|
|
|
local commands; commands=(
|
2021-08-15 11:56:56 +00:00
|
|
|
'add:Add a new directory or increment its rank' \
|
2023-01-07 17:28:10 +00:00
|
|
|
'edit:Edit the database' \
|
2021-08-15 11:56:56 +00:00
|
|
|
'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-03 21:03:23 +00:00
|
|
|
)
|
|
|
|
_describe -t commands 'zoxide commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_zoxide__add_commands] )) ||
|
|
|
|
_zoxide__add_commands() {
|
2021-08-15 11:56:56 +00:00
|
|
|
local commands; commands=()
|
2021-05-03 21:03:23 +00:00
|
|
|
_describe -t commands 'zoxide add commands' commands "$@"
|
|
|
|
}
|
2023-01-07 17:28:10 +00:00
|
|
|
(( $+functions[_zoxide__edit__decrement_commands] )) ||
|
|
|
|
_zoxide__edit__decrement_commands() {
|
|
|
|
local commands; commands=()
|
|
|
|
_describe -t commands 'zoxide edit decrement commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_zoxide__edit__delete_commands] )) ||
|
|
|
|
_zoxide__edit__delete_commands() {
|
|
|
|
local commands; commands=()
|
|
|
|
_describe -t commands 'zoxide edit delete commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_zoxide__edit_commands] )) ||
|
|
|
|
_zoxide__edit_commands() {
|
|
|
|
local commands; commands=(
|
|
|
|
'decrement:' \
|
|
|
|
'delete:' \
|
|
|
|
'increment:' \
|
|
|
|
'reload:' \
|
|
|
|
)
|
|
|
|
_describe -t commands 'zoxide edit commands' commands "$@"
|
|
|
|
}
|
2021-05-03 21:03:23 +00:00
|
|
|
(( $+functions[_zoxide__import_commands] )) ||
|
|
|
|
_zoxide__import_commands() {
|
2021-08-15 11:56:56 +00:00
|
|
|
local commands; commands=()
|
2021-05-03 21:03:23 +00:00
|
|
|
_describe -t commands 'zoxide import commands' commands "$@"
|
|
|
|
}
|
2023-01-07 17:28:10 +00:00
|
|
|
(( $+functions[_zoxide__edit__increment_commands] )) ||
|
|
|
|
_zoxide__edit__increment_commands() {
|
|
|
|
local commands; commands=()
|
|
|
|
_describe -t commands 'zoxide edit increment commands' commands "$@"
|
|
|
|
}
|
2021-05-03 21:03:23 +00:00
|
|
|
(( $+functions[_zoxide__init_commands] )) ||
|
|
|
|
_zoxide__init_commands() {
|
2021-08-15 11:56:56 +00:00
|
|
|
local commands; commands=()
|
2021-05-03 21:03:23 +00:00
|
|
|
_describe -t commands 'zoxide init commands' commands "$@"
|
|
|
|
}
|
|
|
|
(( $+functions[_zoxide__query_commands] )) ||
|
|
|
|
_zoxide__query_commands() {
|
2021-08-15 11:56:56 +00:00
|
|
|
local commands; commands=()
|
2021-05-03 21:03:23 +00:00
|
|
|
_describe -t commands 'zoxide query commands' commands "$@"
|
|
|
|
}
|
2023-01-07 17:28:10 +00:00
|
|
|
(( $+functions[_zoxide__edit__reload_commands] )) ||
|
|
|
|
_zoxide__edit__reload_commands() {
|
|
|
|
local commands; commands=()
|
|
|
|
_describe -t commands 'zoxide edit reload commands' commands "$@"
|
|
|
|
}
|
2021-05-03 21:03:23 +00:00
|
|
|
(( $+functions[_zoxide__remove_commands] )) ||
|
|
|
|
_zoxide__remove_commands() {
|
2021-08-15 11:56:56 +00:00
|
|
|
local commands; commands=()
|
2021-05-03 21:03:23 +00:00
|
|
|
_describe -t commands 'zoxide remove commands' commands "$@"
|
|
|
|
}
|
|
|
|
|
2023-04-14 20:35:48 +00:00
|
|
|
if [ "$funcstack[1]" = "_zoxide" ]; then
|
|
|
|
_zoxide "$@"
|
|
|
|
else
|
|
|
|
compdef _zoxide zoxide
|
|
|
|
fi
|