diff options
author | Taylor C. Richberger <taywee@gmx.com> | 2017-12-25 22:49:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-25 22:49:30 -0700 |
commit | 365c0cad14aa194dfa5cf68caca3cc20c7d39076 (patch) | |
tree | 5391d4b0e55b25d4c909ff4e816dcb742132cf2f /examples/bash_completion.sh | |
parent | replace explicit std::vector ParseCLI with template, reduce optimization (diff) | |
parent | add more test cases (diff) | |
download | args.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.sh | 13 |
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 |