added completion function for bash
This commit is contained in:
1 parent
6f28e63e3a
commit
e5746c38bb
1 file changed
+18
@@ -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
|
||||
Reference in new issue
Block a user