zoxide/contrib/completions/zoxide.elv
2021-08-15 17:26:56 +05:30

79 lines
3.0 KiB
Plaintext

use builtin;
use str;
edit:completion:arg-completer[zoxide] = [@words]{
fn spaces [n]{
builtin:repeat $n ' ' | str:join ''
}
fn cand [text desc]{
edit:complex-candidate $text &display-suffix=' '(spaces (- 14 (wcswidth $text)))$desc
}
command = 'zoxide'
for word $words[1..-1] {
if (str:has-prefix $word '-') {
break
}
command = $command';'$word
}
completions = [
&'zoxide'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
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'= {
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;import'= {
cand --from 'Application to import from'
cand --merge 'Merge into existing database'
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'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'
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;query'= {
cand --exclude 'Exclude a path from results'
cand --all 'Show deleted directories'
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'
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
&'zoxide;remove'= {
cand -i 'i'
cand --interactive 'interactive'
cand -h 'Print help information'
cand --help 'Print help information'
cand -V 'Print version information'
cand --version 'Print version information'
}
]
$completions[$command]
}