| 1 |
#compdef flatpak |
| 2 |
|
| 3 |
emulate -L zsh |
| 4 |
|
| 5 |
local index |
| 6 |
(( index = ${(c)#words[0,CURRENT]} + $#PREFIX + 1 )) |
| 7 |
|
| 8 |
|
| 9 |
local resp=($(flatpak complete "$words" $index "$words[CURRENT]")) |
| 10 |
|
| 11 |
_description options opt_expl option |
| 12 |
_description arguments arg_expl argument |
| 13 |
|
| 14 |
local match |
| 15 |
for match in $resp; do |
| 16 |
case $match in |
| 17 |
__FLATPAK_FILE) _files;; |
| 18 |
__FLATPAK_BUNDLE_FILE) _path_files -g '*.flatpak';; |
| 19 |
__FLATPAK_BUNDLE_OR_REF_FILE) _path_files -g '*.flatpak(|ref)';; |
| 20 |
__FLATPAK_DIR) _path_files -/;; |
| 21 |
-*=) compadd $opt_expl[@] -S "" -- $match;; |
| 22 |
-*) compadd $opt_expl[@] -- $match;; |
| 23 |
*) compadd $arg_expl[@] $match;; |
| 24 |
esac |
| 25 |
done |
| 26 |
|
| 27 |
# vim: ft=zsh |