summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2011-10-22 11:48:23 +0300
committerVille Skyttä <ville.skytta@iki.fi>2011-10-22 11:48:23 +0300
commite850ee015e1ac75a60042b17785e0b5fe557da4b (patch)
tree6bab3667720537b17c52890613f464f0540db674
parent5afc526850c28ad51ade1ec773ede268157b33bd (diff)
downloadbash-completion-e850ee015e1ac75a60042b17785e0b5fe557da4b.tar.gz
add_members, bk, gcc, mtx, munin-run, munindoc, mutt, p4, portinstall, postmap, ri, ypmatch: Avoid stderr spewage when needed commands/dirs are not available.
-rw-r--r--completions/add_members2
-rw-r--r--completions/bk4
-rw-r--r--completions/gcc3
-rw-r--r--completions/mtx4
-rw-r--r--completions/munin-run4
-rw-r--r--completions/munindoc4
-rw-r--r--completions/mutt6
-rw-r--r--completions/p42
-rw-r--r--completions/portinstall7
-rw-r--r--completions/postmap2
-rw-r--r--completions/ri6
-rw-r--r--completions/ypmatch5
12 files changed, 26 insertions, 23 deletions
diff --git a/completions/add_members b/completions/add_members
index 1f8aa951..930f9c61 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 abb3dbca..580ec040 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 0351a6bf..c8825115 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 7a0ea98f..12fa12f1 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 cf8ad9c1..03c686d0 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 1c8bb482..527037ee 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 6e2447fd..374e2f1b 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 3fa868cd..40fb6f58 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 24051417..1ff82f5c 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 21a92fac..ac59711d 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 40ce9727..0c02033a 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 a93a9ebf..1b46e41c 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