[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 3d9f8206e1168ad6b756bdd23843b98c4c0749d9
Ville Skyttä
ville.skytta at iki.fi
Mon Dec 21 21:06:12 UTC 2009
The following commit has been merged in the master branch:
commit 3d9f8206e1168ad6b756bdd23843b98c4c0749d9
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Dec 21 23:00:31 2009 +0200
Use awk more to reduce number of invoked commands a bit.
diff --git a/bash_completion b/bash_completion
index ec71a29..1b103d7 100644
--- a/bash_completion
+++ b/bash_completion
@@ -939,8 +939,8 @@ _mount()
for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
if [[ -n "$sm" && "$cur" == *:* ]]; then
- COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | sed 1d | \
- awk '{print $1}' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \
+ awk 'NR>1 {print $1}' )" -- "$cur" ) )
elif [[ "$cur" == //* ]]; then
host=${cur#//}
host=${host%%/*}
@@ -1371,7 +1371,7 @@ _known_hosts_real()
COMPREPLY=( "${COMPREPLY[@]}" $( \
compgen -P "$prefix$user" -S "$suffix" -W \
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
- command grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
+ awk -F\; '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
fi
# Add results of normal hostname completion, unless
diff --git a/contrib/apache2ctl b/contrib/apache2ctl
index 1987d24..d10ac66 100644
--- a/contrib/apache2ctl
+++ b/contrib/apache2ctl
@@ -7,7 +7,7 @@ _apache2ctl() {
COMPREPLY=()
cur=`_get_cword`
- APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | \
+ APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \
tr "|" " ")
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
diff --git a/contrib/bitkeeper b/contrib/bitkeeper
index 85528e8..7d48869 100644
--- a/contrib/bitkeeper
+++ b/contrib/bitkeeper
@@ -7,7 +7,7 @@ _bk() {
COMPREPLY=()
cur=`_get_cword`
- BKCMDS="$( bk help topics | command grep '^ bk' | cut -d ' ' -f 4 | \
+ BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
xargs printf '%s ' )"
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
diff --git a/contrib/brctl b/contrib/brctl
index 0965878..14401ee 100644
--- a/contrib/brctl
+++ b/contrib/brctl
@@ -21,8 +21,8 @@ _brctl()
show)
;;
*)
- COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
- awk '{print $1}' )" -- "$cur" ) )
+ COMPREPLY=( $( compgen -W "$(brctl show | \
+ awk 'NR>1 {print $1}' )" -- "$cur" ) )
esac
;;
3)
diff --git a/contrib/xrandr b/contrib/xrandr
index e9ac632..9367a14 100644
--- a/contrib/xrandr
+++ b/contrib/xrandr
@@ -10,7 +10,7 @@ _xrandr()
case "$prev" in
--output)
- local outputs=$(xrandr|command grep 'connected'|awk '{print $1}')
+ local outputs=$(xrandr|awk '/connected/ {print $1}')
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
return 0
;;
--
bash-completion
More information about the Bash-completion-commits
mailing list