Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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