aboutsummaryrefslogtreecommitdiff
path: root/examples/bash_completion.sh
diff options
context:
space:
mode:
authorTaylor C. Richberger <taywee@gmx.com>2017-12-25 22:49:30 -0700
committerGitHub <noreply@github.com>2017-12-25 22:49:30 -0700
commit365c0cad14aa194dfa5cf68caca3cc20c7d39076 (patch)
tree5391d4b0e55b25d4c909ff4e816dcb742132cf2f /examples/bash_completion.sh
parentreplace explicit std::vector ParseCLI with template, reduce optimization (diff)
parentadd more test cases (diff)
downloadargs.hxx-365c0cad14aa194dfa5cf68caca3cc20c7d39076.tar.xz
Merge pull request #56 from pavel-belikov/bash-completion
Bash completion
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