Add command completion for commands after --; fix variable leak --- /etc/bash_completion.d/valgrind 2011-09-03 16:54:19.834831202 +0200 +++ /etc/bash_completion.d/valgrind 2011-09-03 18:38:58.384834089 +0200 @@ -5,7 +5,7 @@ have valgrind && _valgrind() { - local cur prev opts yesno tools choosen_tool + local cur prev opts yesno tools choosen_tool i # list of options with yes|no answer yesno="--trace-children\= --child-silent-after-fork\= --track-fds\= --time-stamp\= --log-fd\= --log-socket\=" @@ -16,6 +16,14 @@ _valgrind() COMPREPLY=() +# do command completion if one of the arguments prior to the current word is -- + for (( i=0; i < COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} == -- ]]; then + _command_offset $((i + 1)) + return 0 + fi + done + # we check if a tool has been defined for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do if [[ ${COMP_WORDS[i]} == "--tool" ]]; then