I have a program foo
for which I've written a bash-completion script, and that all works fine. I have dozens of wrapper-scripts bar1
, bar2
... which just sets one of the command-line options
#/usr/bin/env bash
exec foo --some-option some-value "$@"
and I was rather hoping that the completions for foo
would be in operation for the wrapper scripts, but it seems not. I can generate the completion scripts for each of the wrappers of course, but that seems inelegant and wasteful. Is there some trick available to get the completion to be available in the wrappers?
try this:
_foo_completions() {
# Aquí defines tus completados para `foo`
COMPREPLY=( $(compgen -W "option1 option2 option3" -- "${COMP_WORDS[1]}") )
}
complete -F _foo_completions foo
for script in bar1 bar2 bar3; do
complete -F _foo_completions "$script"
done