aboutsummaryrefslogtreecommitdiffstats
path: root/mkhint.bash-completion
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-05-07 17:42:30 +0200
committerDanilo M. <danix@danix.xyz>2026-05-07 17:42:30 +0200
commit804a499754f5fec2db465effb174448d924e344e (patch)
tree7ab90f0361813aab8371a95e751fbe41f07762f1 /mkhint.bash-completion
parent03b2f896062ce689df655160328381004b3ad26d (diff)
downloadmkhintfile-804a499754f5fec2db465effb174448d924e344e.tar.gz
mkhintfile-804a499754f5fec2db465effb174448d924e344e.zip
rename mkhintfile.sh to mkhint, add --delete/-d optionHEADmaster
- Rename script and completion file to mkhint/mkhint.bash-completion - Add --delete/-d flag to remove one or more hint files (and .bak if present) - Fix bash completion: correct hint_dir path, use find for nested .info files, add --delete completion, add flag name completion - Update all references in CLAUDE.md, README.md, and source files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'mkhint.bash-completion')
-rw-r--r--mkhint.bash-completion37
1 files changed, 37 insertions, 0 deletions
diff --git a/mkhint.bash-completion b/mkhint.bash-completion
new file mode 100644
index 0000000..43a64ae
--- /dev/null
+++ b/mkhint.bash-completion
@@ -0,0 +1,37 @@
+# bash completion for mkhint
+# Install: sudo cp mkhint.bash-completion /etc/bash-completion.d/mkhint
+
+_mkhintfile_completions() {
+ local cur prev repo_dir hint_dir
+ _init_completion || return
+
+ repo_dir="/var/lib/sbopkg/SBo-danix"
+ hint_dir="/etc/slackrepo/SBo-danix/hintfiles"
+
+ local all_flags="--version --hintfile --new --list --clean --delete --help"
+
+ case "$prev" in
+ --new|-n)
+ local -a words=()
+ while IFS= read -r f; do
+ words+=("$(basename "${f%.info}")")
+ done < <(find "$repo_dir" -mindepth 2 -maxdepth 2 -name "*.info" 2>/dev/null)
+ COMPREPLY=($(compgen -W "${words[*]}" -- "$cur"))
+ ;;
+ --hintfile|-f|--delete|-d)
+ local -a words=()
+ for f in "$hint_dir"/*.hint; do
+ [[ -f "$f" ]] && words+=("$(basename "${f%.hint}")")
+ done
+ COMPREPLY=($(compgen -W "${words[*]}" -- "$cur"))
+ ;;
+ --version|-v)
+ # no completion, raw text
+ ;;
+ *)
+ COMPREPLY=($(compgen -W "$all_flags" -- "$cur"))
+ ;;
+ esac
+}
+
+complete -F _mkhintfile_completions mkhintfile.sh mkhintfile