diff options
author | Pavel Belikov <pavel.fuchs.belikov@gmail.com> | 2017-12-23 21:07:26 +0300 |
---|---|---|
committer | Pavel Belikov <pavel.fuchs.belikov@gmail.com> | 2017-12-23 21:07:26 +0300 |
commit | 4b983b8f035dbd854edc3fd50c767d913bf775ad (patch) | |
tree | 6ce5b4ed6fddd56ff6a366c537a02bd8fa196630 /examples/bash_completion.sh | |
parent | fix bash equal sign tokenization (diff) | |
download | args.hxx-4b983b8f035dbd854edc3fd50c767d913bf775ad.tar.xz |
add examples
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 |