.bashrc
changeset 246 1622a1ee71fc
parent 244 64924a7c3689
parent 242 a13e9cd16022
child 252 2fa0c2abe304
equal deleted inserted replaced
245:aefd2167af31 246:1622a1ee71fc
   236   COMPREPLY=( ${COMPREPLY[@]%.*} )
   236   COMPREPLY=( ${COMPREPLY[@]%.*} )
   237   COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) )
   237   COMPREPLY=( $(compgen -W '${COMPREPLY[@]}' -- $cur ) )
   238 }
   238 }
   239 complete -F _man man
   239 complete -F _man man
   240 
   240 
       
   241 _make() {
       
   242   local mk
       
   243   local cur=${COMP_WORDS[COMP_CWORD]}
       
   244   [[ $COMP_CWORD > 0 ]] && prev=${COMP_WORDS[COMP_CWORD-1]}
       
   245   if [[ $prev = -f ]]; then
       
   246     COMPREPLY=( $(compgen -f -- "$cur") )
       
   247     return 0
       
   248   fi
       
   249   for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
       
   250     if [[ ${COMP_WORDS[i]} == -f ]]; then
       
   251       mk=${COMP_WORDS[i+1]}
       
   252       break
       
   253     fi
       
   254   done
       
   255   [[ ! -f $mk ]] && mk=$(eval echo [Mm]akefile)
       
   256   [[ -f $mk ]] || return 0
       
   257   COMPREPLY=( $(compgen -W "$(sed -n -e '/^[[:alnum:]_-]*:/{s=^\([^:]*\):.*=\1=;p;}' $mk)" -- $cur) )
       
   258   return 0
       
   259 }
       
   260 complete -F _make make gmake pmake
       
   261 
   241 # Use bash-completion, if available.
   262 # Use bash-completion, if available.
   242 if [ -f /etc/bash_completion ]; then
   263 if [ -f /etc/bash_completion ]; then
   243   # Under Cygwin bash completition start a long time.
   264   # Under Cygwin bash completition start a long time.
   244   if [ ! "$OSTYPE" = cygwin ]; then
   265   if [ ! "$OSTYPE" = cygwin ]; then
   245     . /etc/bash_completion
   266     . /etc/bash_completion