[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 9a7c9804f207981834cb85b7b92c3a0a30c94eaa
Ville Skyttä
ville.skytta at iki.fi
Fri Jun 12 17:13:00 UTC 2009
The following commit has been merged in the master branch:
commit 9a7c9804f207981834cb85b7b92c3a0a30c94eaa
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Fri Jun 12 20:12:47 2009 +0300
Use compgen -W instead of grepping $cur in wireless-tools.
diff --git a/contrib/wireless-tools b/contrib/wireless-tools
index 1d3fb84..fb166f9 100644
--- a/contrib/wireless-tools
+++ b/contrib/wireless-tools
@@ -24,10 +24,10 @@ _iwconfig()
essid)
COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} scan | \
- awk -F '"' '/ESSID/ {print $2}' | \
- grep "^$cur" ))
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} scan | \
+ awk -F '\"' '/ESSID/ {print $2}' )" \
+ -- $cur ) )
fi
return 0
;;
@@ -36,49 +36,43 @@ _iwconfig()
return 0
;;
channel)
- COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $2}' | \
- grep "^$cur" ) )
+ COMPREPLY=( $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} channel | \
+ awk '/^[[:space:]]*Channel/ {print $2}' )" \
+ -- $cur ) )
return 0
;;
freq)
- COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
- awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
- grep "^$cur" ) )
+ COMPREPLY=( $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} channel | \
+ awk '/^[[:space:]]*Channel/ {print $4\"G\"}')" \
+ -- $cur ) )
return 0
;;
ap)
COMPREPLY=( $( compgen -W 'on off any' -- $cur ) )
if [ -n "${COMP_IWLIST_SCAN:-}" ]; then
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} scan | \
- awk -F ': ' '/Address/ {print $2}' | \
- grep "^$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} scan | \
+ awk -F ': ' '/Address/ {print $2}' )" \
+ -- $cur ) )
fi
return 0
;;
rate)
COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
- COMPREPLY=( "${COMPREPLY[@]}" \
- $( iwlist ${COMP_WORDS[1]} rate | \
- awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
- grep "^$cur" ) )
+ COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W \
+ "$( iwlist ${COMP_WORDS[1]} rate | \
+ awk '/^[[:space:]]*[0-9]/ {print $1\"M\"}' )" \
+ -- $cur ) )
return 0
;;
- rts)
+ rts|frag)
COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
return 0
;;
- frag)
- COMPREPLY=( $( compgen -W 'auto fixed off' -- $cur ) )
- return 0
- ;;
- key)
- COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
- return 0
- ;;
- enc)
+ key|enc)
COMPREPLY=( $( compgen -W 'off on open restricted' -- $cur ) )
return 0
;;
--
bash-completion
More information about the Bash-completion-commits
mailing list