about summary refs log tree commit diff stats
path: root/config/ksh/completions.ksh
blob: d1866150e6ef7ba4e217df29a7139f6544caf24a (plain) (blame)
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/ksh

COMPLETIONFILES="$XDG_CACHE_HOME/ksh/precompletions"
if ! [[ -d $COMPLETIONFILES ]]; then
	mkdir -p $COMPLETIONFILES;
fi
#pkg_* completions {{{1
if ! [[ -e $COMPLETIONFILES/packages ]]; then
	update_completion_packages
fi

#set -A complete_pa -- $(<$COMPLETIONFILES/packages)
set -A complete_pd -- $(ls -1 /var/db/pkg)
#set -A complete_pi -- $complete_pa

# }}}

#man completions {{{2
if ! [[ -e $COMPLETIONFILES/manpages ]]; then
	update_completion_manpages
fi

#set -A complete_man -- $(<$COMPLETIONFILES/manpages)


# }}}

# pip completions {{{3

set -A complete_pip_1 -- install download uninstall freeze list show check config search wheel hash help
set -A complete_pip_2 -- --user
set -A complete_pip_3 -- --upgrade

# pass completions
update_complete_pass() {
	pass_list=$(pass ls)
	set -A complete_pass_1 -- init passphrase add import show export ls
	set -A complete_pass_2 -- $pass_list
	set -A complete_pcl_1 -- $pass_list
	set -A complete_pct_1 -- $pass_list
}
update_complete_pass
pass_export() { pass export "$1" && update_complete_pass; }
pass_show() { pass show "$1" && update_complete_pass; }

# }}}