]> git.pld-linux.org Git - packages/bash-completion.git/commitdiff
- save something
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 19 Oct 2010 19:56:30 +0000 (19:56 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    builder.bash-completion -> 1.2

builder.bash-completion

index 2ac77893514e40196f7b176f2b8bacba06d8872e..978a20f888330287d33f7e445c183d3cdf9d5ae4 100644 (file)
@@ -1,38 +1,44 @@
 # builder(1) completion
-#
+
 _builder()
 {
        local cur prev first
 
        COMPREPLY=()
-       cur=${COMP_WORDS[COMP_CWORD]}
+       cur=`_get_cword`
        prev=${COMP_WORDS[COMP_CWORD-1]}
 
-       if [ $COMP_CWORD -eq 1 ]; then
-               # first parameter on line
-               case "$cur" in
-               *)
-
-                       COMPREPLY=( $( compgen -W '
-                               -5 -a5 -n5 -D -V -a -b -ba -bb -bp -bc -bi -bl -bs -B -c -cf -d -g
-                               -h -l -m -nc -ncs -nd -nm -nu -ns -ns0 -nn -ske -q -r -A -R -RB
-                               -FRB -sd -sdp -sf -sp -su -T -Tvs -Ts -Tv -Tp -tt -ir -v -u -un
-                               -U -Upi -np
-                       ' -- $cur ) )
+       case "$prev" in
+               -@(g|--get))
+                       _filedir
+                       return 0
                        ;;
-               esac
+               --with|--without)
+                       ./builder --show-avail-bconds automake.spec
+                       return 0
+                       ;;
+       esac
 
-       return 0
+       if [[ "$cur" == -* ]]; then
+               COMPREPLY=( $( compgen -W '
+                       -5 -a5 -n5 -D -V -a -b -ba -bb -bp -bc -bi -bl -bs -B -c -cf -d -g
+                       -h -l -m -nc -ncs -nd -nm -nu -ns -ns0 -nn -ske -q -r -A -R -RB
+                       -FRB -sd -sdp -sf -sp -su -T -Tvs -Ts -Tv -Tp -tt -ir -v -u -un
+                       -U -Upi -np
+                       --with --without
+               ' -- $cur ) )
+       else
+               # find which specfile to use
+               specfile=
+               for (( i=1; i < COMP_CWORD; i++ )); do
+                       if [[ "${COMP_WORDS[i]}" == -@(?(build)file|f) ]]; then
+                               specfile=${COMP_WORDS[i+1]}
+                               break
+                       fi
+               done
+               [ ! -f $specfile ] && return 0
        fi
 
-       first=${COMP_WORDS[1]}
-
-       case "$first" in
-       -@(g|--get))
-               _filedir
-               ;;
-       esac
-
        return 0
 }
 #complete -F _builder builder
This page took 0.078909 seconds and 4 git commands to generate.