I'm creating a new command and I need a completion function so that when I press tab a couple of times it gives me some alternatives to choose from. The list of alternatives should be the branches available in a git repository.
I've used complete -W $(git branch | grep -v '^*' | xagrs) my_command
but that creates a static list once .bashrc is "compiled" and it's not dynamic per repository.
Also I've found complete -c
but that doesn't seem to work.
Any ideas?