-
Notifications
You must be signed in to change notification settings - Fork 0
/
spm.comp
46 lines (43 loc) · 1.53 KB
/
spm.comp
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
#!/bin/bash
# Title: spm
# Description: Downloads and installs AppImages and precompiled tar archives. Can also upgrade and remove installed packages.
# Dependencies: GNU coreutils, tar, wget
# Author: simonizor
# Website: http://www.simonizor.gq
# License: GPL v2.0 only
_spm () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'1: :->args'\
'2: :->input'
case $state in
args)
_arguments '1:arguments:(-h -l -li -i -r -upd -uf -upg -m)'
;;
*)
case $words[2] in
-l)
compadd "$@" $(cat ~/.config/spm/AppImages.yml | cut -f1 -d":") $(cat ~/.config/spm/tar-pkgs.yml | cut -f1 -d":")
;;
-s)
compadd "$@" $(cat ~/.config/spm/AppImages.yml | cut -f1 -d":") $(cat ~/.config/spm/tar-pkgs.yml | cut -f1 -d":")
;;
-i|-ai|-ti)
compadd "$@" $(cat ~/.config/spm/AppImages.yml | cut -f1 -d":") $(cat ~/.config/spm/tar-pkgs.yml | cut -f1 -d":")
;;
-r|-ar|-tr)
compadd "$@" $(dir ~/.config/spm/appimginstalled) $(dir ~/.config/spm/tarinstalled)
;;
-upd)
compadd "$@" $(dir ~/.config/spm/appimginstalled) $(dir ~/.config/spm/tarinstalled)
;;
-uf|-auf|-tuf)
compadd "$@" $(dir ~/.config/spm/appimginstalled) $(dir ~/.config/spm/tarinstalled)
;;
-upg)
compadd "$@" $(dir ~/.config/spm/appimgupgrades) $(dir ~/.config/spm/tarupgrades)
;;
esac
esac
}