2022-03-07 20:03:46 +00:00
|
|
|
|
|
|
|
use builtin;
|
|
|
|
use str;
|
|
|
|
|
|
|
|
set edit:completion:arg-completer[my-app] = {|@words|
|
|
|
|
fn spaces {|n|
|
|
|
|
builtin:repeat $n ' ' | str:join ''
|
|
|
|
}
|
|
|
|
fn cand {|text desc|
|
|
|
|
edit:complex-candidate $text &display=$text' '(spaces (- 14 (wcswidth $text)))$desc
|
|
|
|
}
|
|
|
|
var command = 'my-app'
|
|
|
|
for word $words[1..-1] {
|
|
|
|
if (str:has-prefix $word '-') {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
set command = $command';'$word
|
|
|
|
}
|
|
|
|
var completions = [
|
|
|
|
&'my-app'= {
|
|
|
|
cand --choice 'choice'
|
|
|
|
cand --unknown 'unknown'
|
|
|
|
cand --other 'other'
|
|
|
|
cand -p 'p'
|
|
|
|
cand --path 'path'
|
|
|
|
cand -f 'f'
|
|
|
|
cand --file 'file'
|
|
|
|
cand -d 'd'
|
|
|
|
cand --dir 'dir'
|
|
|
|
cand -e 'e'
|
|
|
|
cand --exe 'exe'
|
|
|
|
cand --cmd-name 'cmd-name'
|
|
|
|
cand -c 'c'
|
|
|
|
cand --cmd 'cmd'
|
|
|
|
cand -u 'u'
|
|
|
|
cand --user 'user'
|
2022-08-08 21:08:47 +00:00
|
|
|
cand -H 'H'
|
2022-03-07 20:03:46 +00:00
|
|
|
cand --host 'host'
|
|
|
|
cand --url 'url'
|
|
|
|
cand --email 'email'
|
2022-08-08 21:08:47 +00:00
|
|
|
cand -h 'Print help information'
|
2022-03-07 20:03:46 +00:00
|
|
|
cand --help 'Print help information'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
$completions[$command]
|
|
|
|
}
|