| 1 |
#compdef fdroidcl |
| 2 |
|
| 3 |
_fdroidcl() { |
| 4 |
local -a commands |
| 5 |
commands=( |
| 6 |
'update:update the index' |
| 7 |
'search:search available apps' |
| 8 |
'show:show detailed info about an app' |
| 9 |
'list:list all known values of a kind' |
| 10 |
'devices:list connected devices' |
| 11 |
'scan:list all fdroid apps on a device' |
| 12 |
'download:download an app' |
| 13 |
'install:install or upgrade an app' |
| 14 |
'uninstall:uninstall an app' |
| 15 |
'setup:manage setups' |
| 16 |
'repo:manage repos' |
| 17 |
'defaults:reset to the default settings') |
| 18 |
|
| 19 |
_arguments \ |
| 20 |
'1:command:{_describe -t commands command commands}' \ |
| 21 |
'*:: :_fdroidcl_options' |
| 22 |
return 0 |
| 23 |
} |
| 24 |
|
| 25 |
(( $+functions[_fdroidcl_options] )) || |
| 26 |
_fdroidcl_options() { |
| 27 |
local -a packages |
| 28 |
case ${(Q)words[1]} in |
| 29 |
(list) |
| 30 |
_describe -t lists list '(categories)' |
| 31 |
;; |
| 32 |
(search) |
| 33 |
_arguments -S \ |
| 34 |
'-q[print package names only]' \ |
| 35 |
'-o[sort order]:sort order:(added updated)' \ |
| 36 |
'(-u)-i[filter installed apps]' \ |
| 37 |
'(-i)-u[filter apps with updates]' \ |
| 38 |
'-d[filter apps by last updated]:updated since (days):' \ |
| 39 |
'-c[filter apps by category]:category:_fdroidcl_categories' |
| 40 |
;; |
| 41 |
(show|download|install|uninstall) |
| 42 |
packages=(${(f)"$(fdroidcl search -q 2> /dev/null)"}) |
| 43 |
_describe -t packages package packages |
| 44 |
;; |
| 45 |
esac |
| 46 |
} |
| 47 |
|
| 48 |
(( $+functions[_fdroidcl_categories] )) || |
| 49 |
_fdroidcl_categories() { |
| 50 |
local -a categories |
| 51 |
categories=(${(f)"$(fdroidcl list categories 2> /dev/null)"}) |
| 52 |
_describe -t categories category categories |
| 53 |
} |