[Bash-completion-commits] [SCM] bash-completion branch, dynamic-loading, updated. 1.3-468-ge850ee0

Ville Skyttä ville.skytta at iki.fi
Sat Oct 22 08:49:24 UTC 2011


The following commit has been merged in the dynamic-loading branch:
commit e850ee015e1ac75a60042b17785e0b5fe557da4b
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Sat Oct 22 11:48:23 2011 +0300

    add_members, bk, gcc, mtx, munin-run, munindoc, mutt, p4, portinstall, postmap, ri, ypmatch: Avoid stderr spewage when needed commands/dirs are not available.

diff --git a/completions/add_members b/completions/add_members
index 1f8aa95..930f9c6 100644
--- a/completions/add_members
+++ b/completions/add_members
@@ -2,7 +2,7 @@
 
 _mailman_lists()
 {
-    COMPREPLY=( $( compgen -W '$( list_lists -b )' -- "$cur" ) )
+    COMPREPLY=( $( compgen -W '$( list_lists -b 2>/dev/null )' -- "$cur" ) )
 }
 
 _add_members()
diff --git a/completions/bk b/completions/bk
index abb3dbc..580ec04 100644
--- a/completions/bk
+++ b/completions/bk
@@ -5,8 +5,8 @@ _bk()
     local cur prev words cword
     _init_completion || return
 
-    local BKCMDS="$( bk help topics | awk '/^  bk/ { print $4 }' | \
-        xargs printf '%s ' )"
+    local BKCMDS="$( bk help topics 2>/dev/null | \
+        awk '/^  bk/ { print $4 }' | xargs printf '%s ' )"
 
     COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
     _filedir
diff --git a/completions/gcc b/completions/gcc
index 0351a6b..c882511 100644
--- a/completions/gcc
+++ b/completions/gcc
@@ -33,7 +33,8 @@ _gcc()
     esac
 
     if [[ "$cur" == -* ]]; then
-        cc=$( $1 -print-prog-name=$backend )
+        cc=$( $1 -print-prog-name=$backend 2>/dev/null )
+        [[ $cc ]] || return
         # sink stderr:
         # for C/C++/ObjectiveC it's useless
         # for FORTRAN/Java it's an error
diff --git a/completions/mtx b/completions/mtx
index 7a0ea98..12fa12f 100644
--- a/completions/mtx
+++ b/completions/mtx
@@ -10,11 +10,11 @@ _mtx()
     options="-f nobarcode invert noattach --version inquiry noattach \
         inventory status load unload eepos first last next"
 
-    tapes=$(mtx status | \
+    tapes=$(mtx status 2>/dev/null | \
         awk '/Storage Element [0-9]+:Full/ { printf "%s ", $3 }')
     tapes=${tapes//:Full}
 
-    drives=$(mtx status | \
+    drives=$(mtx status 2>/dev/null | \
         awk '/Data Transfer Element [0-9]+:(Full|Empty)/ { printf "%s ", $4 }')
     drives=${drives//:Full}
     drives=${drives//:Empty}
diff --git a/completions/munin-run b/completions/munin-run
index cf8ad9c..03c686d 100644
--- a/completions/munin-run
+++ b/completions/munin-run
@@ -19,8 +19,8 @@ _munin_run()
     if [[ "$cur" == -* ]]; then
         COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
     else
-        COMPREPLY=( $( compgen -W '$( command ls /etc/munin/plugins )' \
-            -- "$cur" ) )
+        COMPREPLY=( $( compgen -W \
+            '$( command ls /etc/munin/plugins 2>/dev/null )' -- "$cur" ) )
     fi
 } &&
 complete -F _munin_run munin-run
diff --git a/completions/munindoc b/completions/munindoc
index 1c8bb48..527037e 100644
--- a/completions/munindoc
+++ b/completions/munindoc
@@ -5,8 +5,8 @@ _munindoc()
     local cur prev words cword
     _init_completion || return
 
-    COMPREPLY=( $( compgen -W '$( command ls /usr/share/munin/plugins )' \
-        -- "$cur" ) )
+    COMPREPLY=( $( compgen -W \
+        '$( command ls /usr/share/munin/plugins 2>/dev/null )' -- "$cur" ) )
 } &&
 complete -F _munindoc munindoc
 
diff --git a/completions/mutt b/completions/mutt
index 6e2447f..374e2f1 100644
--- a/completions/mutt
+++ b/completions/mutt
@@ -95,7 +95,7 @@ _muttquery()
     local cur=$1 querycmd muttcmd=${words[0]}
     local -a queryresults
 
-    querycmd="$( $muttcmd -Q query_command | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )"
+    querycmd="$( $muttcmd -Q query_command 2>/dev/null | sed -e 's|^query_command=\"\(.*\)\"$|\1|' -e 's|%s|'$cur'|' )"
     if [[ -z "$cur" || -z "$querycmd" ]]; then
         queryresults=()
     else
@@ -117,7 +117,7 @@ _muttfiledir()
 
     muttrc=$(_muttrc)
     if [[ $cur == [=+]* ]]; then
-        folder="$( $muttcmd -F "$muttrc" -Q folder | sed -e 's|^folder=\"\(.*\)\"$|\1|' )"
+        folder="$( $muttcmd -F "$muttrc" -Q folder 2>/dev/null | sed -e 's|^folder=\"\(.*\)\"$|\1|' )"
         : folder:=~/Mail
 
         # Match any file in $folder beginning with $cur
@@ -127,7 +127,7 @@ _muttfiledir()
         COMPREPLY=( ${COMPREPLY[@]#$folder/} )
         return 0
     elif [ "$cur" == !* ]; then
-        spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile | \
+        spoolfile="$( $muttcmd -F "$muttrc" -Q spoolfile 2>/dev/null | \
             sed -e 's|^spoolfile=\"\(.*\)\"$|\1|' )"
         [ ! -z "$spoolfile" ] && eval cur="${cur/^!/$spoolfile}"
     fi
diff --git a/completions/p4 b/completions/p4
index 3fa868c..40fb6f5 100644
--- a/completions/p4
+++ b/completions/p4
@@ -8,7 +8,7 @@ _p4()
     local p4commands p4filetypes
 
     # rename isn't really a command
-    p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
+    p4commands="$( p4 help commands 2>/dev/null | awk 'NF>3 {print $1}' )"
     p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
         uresource uxbinary xbinary xltext xtempobj xtext \
         text binary resource"
diff --git a/completions/portinstall b/completions/portinstall
index 2405141..1ff82f5 100644
--- a/completions/portinstall
+++ b/completions/portinstall
@@ -18,9 +18,10 @@ _portinstall()
 
     [[ "$prev" == -l || "$prev" == -L || "$prev" == -o ]] && return 0
 
-    COMPREPLY=( $( command grep -E "^$cur" < $indexfile | cut -d'|' -f1 ) )
-    COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" < $indexfile | \
-        cut -d'|' -f2 ) )
+    COMPREPLY=( $( command grep -E "^$cur" 2>/dev/null < $indexfile | \
+        cut -d'|' -f1 ) )
+    COMPREPLY2=( $( command grep -E "^[^\|]+\|$portsdir$cur" 2>/dev/null \
+        < $indexfile | cut -d'|' -f2 ) )
     COMPREPLY2=( ${COMPREPLY2[@]#$portsdir} )
     COMPREPLY+=( "${COMPREPLY2[@]}" )
 
diff --git a/completions/postmap b/completions/postmap
index 21a92fa..ac59711 100644
--- a/completions/postmap
+++ b/completions/postmap
@@ -25,7 +25,7 @@ _postmap()
         COMPREPLY=( $( compgen -f -- "${cur#*:}" ) )
     else
         local len=${#cur} idx=0 pval
-        for pval in $( /usr/sbin/postconf -m ); do
+        for pval in $( /usr/sbin/postconf -m 2>/dev/null ); do
             if [[ "$cur" == "${pval:0:$len}" ]]; then
                 COMPREPLY[$idx]="$pval:"
                 idx=$(($idx+1))
diff --git a/completions/ri b/completions/ri
index 40ce972..0c02033 100644
--- a/completions/ri
+++ b/completions/ri
@@ -17,7 +17,7 @@ ri_get_methods()
             "$( ri ${classes[@]} 2>/dev/null | ruby -ane \
             'if /^'"$regex"' methods:/.../^------------------|^$/ and \
             /^ / then print $_.split(/, |,$/).grep(/^[^\[]*$/).join("\n"); \
-            end' | sort -u )" )
+            end' 2>/dev/null | sort -u )" )
     else
         # older versions of ri didn't distinguish between class/module and
         # instance methods
@@ -61,8 +61,8 @@ _ri()
 
     if [ "$ri_version" = integrated ]; then
         # integrated ri from Ruby 1.9
-        classes=( $( ri -c | ruby -ne 'if /^\s*$/..$stdin.eof then \
-        if /, [A-Z]+/ then print; end; end' ) )
+        classes=( $( ri -c 2>/dev/null | ruby -ne 'if /^\s*$/..$stdin.eof then \
+        if /, [A-Z]+/ then print; end; end' 2>/dev/null ) )
     elif [ "$ri_version" = "ri 1.8a" ]; then
         classes=( $( ruby -W0 $ri_path | \
             ruby -ne 'if /^'"'"'ri'"'"' has/..$stdin.eof then \
diff --git a/completions/ypmatch b/completions/ypmatch
index a93a9eb..1b46e41 100644
--- a/completions/ypmatch
+++ b/completions/ypmatch
@@ -12,12 +12,13 @@ _ypmatch()
 
     if [[ $cmd == ypmatch && $cword -eq 1 && ${#words[@]} -eq 3 ]]; then
         map=${words[2]}
-        COMPREPLY=( $( compgen -W '$( ypcat $map | \
+        COMPREPLY=( $( compgen -W '$( ypcat $map 2>/dev/null | \
             cut -d':' -f 1 )' -- "$cur") )
     else
         [[ $cmd == ypmatch && $cword -ne 2 ]] && return 0
         COMPREPLY=( $( compgen -W \
-            '$( printf "%s\n" $(ypcat -x | cut -d"\"" -f 2) )' -- "$cur"))
+            '$( printf "%s\n" $(ypcat -x 2>/dev/null | \
+                cut -d"\"" -f 2) )' -- "$cur") )
     fi
 
     return 0

-- 
bash-completion



More information about the Bash-completion-commits mailing list