source: trunk/athena/bin/athrun/bash_completion @ 23806

Revision 23806, 425 bytes checked in by andersk, 16 years ago (diff)
In athrun: [ Evan Broder ] [ Anders Kaseorg ] * Better bash completion.
RevLine 
[23801]1_athrun () {
2    COMPREPLY=()
[23806]3    local cur="${COMP_WORDS[$COMP_CWORD]}"
4
5    if [ $COMP_CWORD -eq 1 ]; then
6        local IFS=$'\n'
7        COMPREPLY=( $(cd /mit && compgen -f -- "$cur") )
8    elif [ $COMP_CWORD -eq 2 ]; then
9        local IFS=$'\n'
10        COMPREPLY=( $(dir="$(eval "athdir /mit/${COMP_WORDS[1]}")" && \
11            cd "$dir" && compgen -f -- "$cur") )
12    else
13        COMP_WORDS[1]=-dummy
14        _command
[23801]15    fi
16}
[23806]17complete -F _athrun $filenames athrun
Note: See TracBrowser for help on using the repository browser.