added completion function for bash

This commit is contained in:
root committed 2026-10-14 13:05:44 +02:00
1 parent 6f28e63e3a
commit e5746c38bb
1 file changed
+18
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
if ! $(command -v scan &>/dev/null); then
exit 1
fi
function _scan {
CURRENT_WORD=${COMP_WORDS[COMP_CWORD]}
if [ "${CURRENT_WORD:0:1}" == "-" ]; then
OPTIONS="$(scan --completions)"
COMPREPLY=($(compgen -W "${OPTIONS}" -- $CURRENT_WORD))
else
COMPREPLY=($(compgen -f))
fi
}
complete -F _scan scan