-
Notifications
You must be signed in to change notification settings - Fork 604
/
Copy path_zoxide
132 lines (121 loc) · 3.47 KB
/
_zoxide
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#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[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_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[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
':path:' \
&& ret=0
;;
(import)
_arguments "${_arguments_options[@]}" \
'--from=[Application to import from]: :(autojump z)' \
'--merge[Merge into existing database]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
':path:' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'--cmd=[Renames the '\''z'\'' command and corresponding aliases]' \
'--hook=[Chooses event upon which an entry is added to the database]: :(none prompt pwd)' \
'--no-aliases[Prevents zoxide from defining any commands]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
':shell:(bash elvish fish nushell posix powershell xonsh zsh)' \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" \
'--exclude=[Exclude a path from results]' \
'(-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]' \
'-s[Print score with results]' \
'--score[Print score with results]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'*::keywords:' \
&& ret=0
;;
(remove)
_arguments "${_arguments_options[@]}" \
'()*-i+[]' \
'()*--interactive=[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'::path:' \
&& ret=0
;;
esac
;;
esac
}
(( $+functions[_zoxide_commands] )) ||
_zoxide_commands() {
local commands; commands=(
"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" \
)
_describe -t commands 'zoxide commands' commands "$@"
}
(( $+functions[_zoxide__add_commands] )) ||
_zoxide__add_commands() {
local commands; commands=(
)
_describe -t commands 'zoxide add commands' commands "$@"
}
(( $+functions[_zoxide__import_commands] )) ||
_zoxide__import_commands() {
local commands; commands=(
)
_describe -t commands 'zoxide import commands' commands "$@"
}
(( $+functions[_zoxide__init_commands] )) ||
_zoxide__init_commands() {
local commands; commands=(
)
_describe -t commands 'zoxide init commands' commands "$@"
}
(( $+functions[_zoxide__query_commands] )) ||
_zoxide__query_commands() {
local commands; commands=(
)
_describe -t commands 'zoxide query commands' commands "$@"
}
(( $+functions[_zoxide__remove_commands] )) ||
_zoxide__remove_commands() {
local commands; commands=(
)
_describe -t commands 'zoxide remove commands' commands "$@"
}
_zoxide "$@"