2021-05-03 21:03:23 +00:00
|
|
|
|
2021-08-15 11:56:56 +00:00
|
|
|
use builtin;
|
|
|
|
use str;
|
|
|
|
|
2021-05-03 21:03:23 +00:00
|
|
|
edit:completion:arg-completer[zoxide] = [@words]{
|
|
|
|
fn spaces [n]{
|
2021-08-15 11:56:56 +00:00
|
|
|
builtin:repeat $n ' ' | str:join ''
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
fn cand [text desc]{
|
|
|
|
edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc
|
|
|
|
}
|
|
|
|
command = 'zoxide'
|
2021-08-15 11:56:56 +00:00
|
|
|
for word $words[1..-1] {
|
|
|
|
if (str:has-prefix $word '-') {
|
2021-05-03 21:03:23 +00:00
|
|
|
break
|
|
|
|
}
|
|
|
|
command = $command';'$word
|
|
|
|
}
|
|
|
|
completions = [
|
|
|
|
&'zoxide'= {
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
cand add 'Add a new directory or increment its rank'
|
|
|
|
cand import 'Import entries from another application'
|
|
|
|
cand init 'Generate shell configuration'
|
|
|
|
cand query 'Search for a directory in the database'
|
|
|
|
cand remove 'Remove a directory from the database'
|
|
|
|
}
|
|
|
|
&'zoxide;add'= {
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
&'zoxide;import'= {
|
|
|
|
cand --from 'Application to import from'
|
|
|
|
cand --merge 'Merge into existing database'
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
&'zoxide;init'= {
|
|
|
|
cand --cmd 'Renames the ''z'' command and corresponding aliases'
|
|
|
|
cand --hook 'Chooses event upon which an entry is added to the database'
|
|
|
|
cand --no-aliases 'Prevents zoxide from defining any commands'
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
&'zoxide;query'= {
|
|
|
|
cand --exclude 'Exclude a path from results'
|
2021-05-08 03:05:34 +00:00
|
|
|
cand --all 'Show deleted directories'
|
2021-05-03 21:03:23 +00:00
|
|
|
cand -i 'Use interactive selection'
|
|
|
|
cand --interactive 'Use interactive selection'
|
|
|
|
cand -l 'List all matching directories'
|
|
|
|
cand --list 'List all matching directories'
|
|
|
|
cand -s 'Print score with results'
|
|
|
|
cand --score 'Print score with results'
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
&'zoxide;remove'= {
|
|
|
|
cand -i 'i'
|
|
|
|
cand --interactive 'interactive'
|
2021-08-15 11:56:56 +00:00
|
|
|
cand -h 'Print help information'
|
|
|
|
cand --help 'Print help information'
|
|
|
|
cand -V 'Print version information'
|
|
|
|
cand --version 'Print version information'
|
2021-05-03 21:03:23 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
$completions[$command]
|
|
|
|
}
|