PageRenderTime 2529ms CodeModel.GetById 48ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 2478ms

/bash_completion_lib/complete -o filenames/gdb

http://github.com/brinkman83/bashrc
#! | 20 lines | 16 code | 4 blank | 0 comment | 0 complexity | 8a7fb60b2ac492bd070b05e9b3787cb1 MD5 | raw file
 1comp_include _get_cword
 2
 3
 4_gdb()
 5{
 6    local cur prev
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    if [ $COMP_CWORD -eq 1 ]; then
13        COMPREPLY=( $( compgen -c -- $cur ) )
14    elif [ $COMP_CWORD -eq 2 ]; then
15        prev=${prev##*/}
16        COMPREPLY=( $( compgen -fW "$( command ps axo comm,pid | \
17                awk '{if ($1 ~ /^'"$prev"'/) print $2}' ) )" \
18                -- "$cur" ) )
19    fi
20} # _gdb()