Skip to content

Instantly share code, notes, and snippets.

@craigphicks
Last active July 23, 2020 20:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save craigphicks/af418e9eb57a493276da60c9e1905044 to your computer and use it in GitHub Desktop.
Save craigphicks/af418e9eb57a493276da60c9e1905044 to your computer and use it in GitHub Desktop.
#!/bin/bash
# copyright craigphicks 2020 - free to use with due attribution
confirm_args(){
logger -t "confirm_args" -- "#=${#}"
for index in `seq 0 ${#}` ; do
eval item=\$$index
logger -t "confirm_args" -- "[$index] ${item}"
done
}
_foo_completion(){
logger -t "_foo_completion" -- "COMP_CWORD=${COMP_CWORD}"
logger -t "_foo_completion" -- "#COMP_WORDS=${#COMP_WORDS[@]}"
for index in `seq 0 $((${#COMP_WORDS[@]}-1))` ; do
logger -t "_foo_completion" -- "[$index] ${COMP_WORDS[$index]}"
done
}
declare -f _foo_completion
complete -F _foo_completion "foo"
alias foo=confirm_args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment