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

Revision 23826, 437 bytes checked in by broder, 15 years ago (diff)
In athrun: * Don't spew errors in bash completion if /mit doesn't exist.
Line 
1_athrun () {
2    COMPREPLY=()
3    local cur="${COMP_WORDS[$COMP_CWORD]}"
4
5    if [ $COMP_CWORD -eq 1 ]; then
6        local IFS=$'\n'
7        COMPREPLY=( $(cd /mit 2>/dev/null && 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
15    fi
16}
17complete -F _athrun $filenames athrun
Note: See TracBrowser for help on using the repository browser.