[linux-elitists] bash completion

Rob Walker rob@myinternetplace.net
Mon Jan 14 17:01:33 PST 2002


>>>>> On Mon, 14 Jan 2002 18:20:53 -0500, Joey Hess <joey@kitenet.net>
>>>>> said:

Joey> joey@silk:~>sudo apt-get install bash-
Joey> bash-builtins     bash-completion   bash-doc

That's cool.

Joey> and completion of filenames in various cvs commands (cvs add
Joey> <tab>). Perhaps bash will catch up eventually.

# cvs(1) completion
#
_cvs()
{
        local cur prev

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
        prev=${COMP_WORDS[COMP_CWORD-1]}

        if [ $COMP_CWORD = 1 ] || [[ "$prev" == -* ]]; then
                COMPREPLY=( $( compgen -W 'add admin checkout commit diff \
                export history import log rdiff release remove rtag status \
                tag update' $cur ))
        fi

        return 0
}
complete -F _cvs -o default cvs

Joey> When I'm feeling bored, I will sometimes play the "what _can't_
Joey> zsh complete?" game. Let's see.. dict. Nope, supported.

What does it do?  Does it run the app with --help and then help
complete the options?  

rob




More information about the linux-elitists mailing list