aboutsummaryrefslogtreecommitdiff
path: root/examples/bash_completion.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bash_completion.sh')
-rw-r--r--examples/bash_completion.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/bash_completion.sh b/examples/bash_completion.sh
new file mode 100644
index 0000000..54937ad
--- /dev/null
+++ b/examples/bash_completion.sh
@@ -0,0 +1,13 @@
+_args() {
+ _init_completion -n 2> /dev/null
+ local program comparg
+
+ program="${COMP_WORDS[0]}"
+ comparg="--complete" # replace this with your flag
+
+ COMPREPLY=($("$program" "$comparg" bash "$COMP_CWORD" "${COMP_WORDS[@]}" 2> /dev/null))
+ [[ $COMPREPLY ]] && return
+ _filedir
+}
+
+complete -F _args completion