When I define an environment variable inline like this: env_variable=true command
, my custom bash completion script fails. Example:
user@host in /tmp/tmp.6DRvQAkpFe
> ls
user@host in /tmp/tmp.6DRvQAkpFe
> docker-ssh
container1 container2 container3 puppetmaster
user@host in /tmp/tmp.6DRvQAkpFe
> VARIABLE=TEST docker-ssh
The last command doesn't autocomplete like the one before it.
My bash completion function looks like this:
_docker-ssh() {
local running=$(docker ps --format '{{.Names}}')
local cur prev opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=($(compgen -W "${running}" -- ${cur}))
return 0
}
complete -F _docker-ssh docker-ssh
Is there something I'm missing in my COMPREPLY
that would take into account environment variables?