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