iwconfig improvements by Guillaume Rousse <Guillaume.Rousse@inria.fr>

This commit is contained in:
ianmacd 2005-07-20 22:57:24 +00:00
parent f23a76343f
commit fa7a4bcaea

View File

@ -1,6 +1,6 @@
# bash_completion - programmable completion functions for bash 3.0 # bash_completion - programmable completion functions for bash 3.0
# #
# $Id: bash_completion,v 1.821 2005/07/21 00:54:36 ianmacd Exp $ # $Id: bash_completion,v 1.822 2005/07/21 00:57:24 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1016,11 +1016,18 @@ _iwconfig()
case $prev in case $prev in
mode) mode)
COMPREPLY=( $( compgen -W 'managed ad-hoc master repeater secondary monitor' -- $cur ) ) COMPREPLY=( $( compgen -W 'managed ad-hoc master \
repeater secondary monitor' -- $cur ) )
return 0 return 0
;; ;;
essid) essid)
COMPREPLY=( $( compgen -W 'on off any' -- $cur ) ) 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" ))
fi
return 0 return 0
;; ;;
nwid) nwid)
@ -1028,20 +1035,34 @@ _iwconfig()
return 0 return 0
;; ;;
channel) channel)
COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | sed -n 's/.*Channel \(.*\) : \(.*\) GHz/\1/p') ) COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
awk '/^[[:space:]]*Channel/ {print $2}' | \
grep "^$cur" ) )
return 0 return 0
;; ;;
freq) freq)
COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | sed -n 's/.*Channel \(.*\) : \(.*\) GHz/\2G/p') ) COMPREPLY=( $( iwlist ${COMP_WORDS[1]} channel | \
awk '/^[[:space:]]*Channel/ {print $4"G"}' | \
grep "^$cur" ) )
return 0 return 0
;; ;;
ap) ap)
COMPREPLY=( $( compgen -W 'auto any off' -- $cur ) ) 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" ) )
fi
return 0 return 0
;; ;;
rate) rate)
COMPREPLY=($( iwlist ${COMP_WORDS[1]} rate | sed -n 's/\(.*\)M.*/\1M/p') auto fixed) COMPREPLY=( $( compgen -W 'auto fixed' -- $cur ) )
COMPREPLY=( ${COMPREPLY[@]:-} \
$( iwlist ${COMP_WORDS[1]} rate | \
awk '/^[[:space:]]*[0-9]/ {print $1"M"}' | \
grep "^$cur" ) )
return 0 return 0
;; ;;
rts) rts)
@ -1106,7 +1127,9 @@ _iwlist()
_available_interfaces -w _available_interfaces -w
fi fi
else else
COMPREPLY=( $( compgen -W 'scanning frequency rate key power txpower retry' -- $cur ) ) COMPREPLY=( $( compgen -W 'scan scanning freq frequency \
channel rate bit bitrate key enc encryption power \
txpower retry ap accesspoint peers event' -- $cur ) )
fi fi
} && } &&
complete -F _iwlist iwlist complete -F _iwlist iwlist