diff options
Diffstat (limited to 'is_installed.bash-completion')
| -rw-r--r-- | is_installed.bash-completion | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/is_installed.bash-completion b/is_installed.bash-completion new file mode 100644 index 0000000..4c3eaa0 --- /dev/null +++ b/is_installed.bash-completion @@ -0,0 +1,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 |
