blob: 4c3eaa060112d2083ae8ee2c6530a43b8df3dabd (
plain)
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
|
# bash completion for is_installed
# -*- shell-script -*-
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
_is_installed()
{
local cur prev words cword
_init_completion -n = || return
local split=false
local i action
for (( i=1; i<${#words[@]}; i++ )); do
if [[ "${words[i]}" != -* ]]; then
action="${words[i]}"
break
fi
done
case "$action" in
help)
# no argument required
return
;;
info)
COMPREPLY=( $(cd /var/log/packages; compgen -f -- "$cur") )
return
;;
file-search)
# argument required but no way to help
return
;;
*)
COMPREPLY+=( $(compgen -W 'help info file-search' -- "$cur") )
return
;;
esac
}
complete -F _is_installed is_installed
# ex: filetype=sh
|