aboutsummaryrefslogtreecommitdiffstats
path: root/is_installed.bash-completion
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-06-29 11:14:20 +0200
committerDanilo M. <danix@danix.xyz>2026-06-29 11:14:20 +0200
commit1e28c6726ba601f43330c1b9a82389b17393442b (patch)
tree325c494b39d93aaf4a82f59b36c8947022773044 /is_installed.bash-completion
downloadis_installed-1e28c6726ba601f43330c1b9a82389b17393442b.tar.gz
is_installed-1e28c6726ba601f43330c1b9a82389b17393442b.zip
Initial commit: is_installed script with GPLv2 license
Slackware package query tool plus bash completion. Add GPLv2 LICENSE, per-file headers, README, and CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'is_installed.bash-completion')
-rw-r--r--is_installed.bash-completion48
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