Ticket #364: bash_completion

File bash_completion, 392 bytes (added by broder, 14 years ago)
Line 
1_athinfo () {
2    COMPREPLY=()
3    local cur="${COMP_WORDS[$COMP_CWORD]}"
4
5    case $COMP_CWORD in
6        1)
7            _known_hosts -a
8            ;;
9        2)
10            COMPREPLY=($(perl -e '$SIG{ALRM} = sub { kill INT => $p }; exec(@ARGV) unless $p = fork; alarm 1; waitpid $p, 0' athinfo "${COMP_WORDS[1]}" queries | awk '! /^#/ && ! /^$/ && /^'"$cur"'/ { print $1 }'))
11            ;;
12    esac
13}
14complete -F _athinfo athinfo