Use {x..y} brace expansion instead of `seq', loops, or long literal sequences.

This commit is contained in:
Ville Skyttä 2011-04-25 23:44:08 +03:00
parent 976ba44825
commit f48d6fb10d
14 changed files with 17 additions and 32 deletions

View File

@ -95,7 +95,7 @@ _yum()
_filedir rpm _filedir rpm
;; ;;
-d|-e) -d|-e)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) ) COMPREPLY=( $( compgen -W '{0..10}' -- $cur ) )
;; ;;
-c) -c)
_filedir _filedir

View File

@ -21,7 +21,7 @@ _ant()
return 0 return 0
;; ;;
-nice) -nice)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
return 0 return 0
;; ;;
-lib|-logger|-listener|-D|-inputhandler|-main) -lib|-logger|-listener|-D|-inputhandler|-main)

View File

@ -16,7 +16,7 @@ _chkconfig()
return 0 return 0
;; ;;
--level) --level)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..6}' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac

View File

@ -369,7 +369,7 @@ _cvs()
return 0 return 0
;; ;;
-z) -z)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac

View File

@ -40,7 +40,7 @@ _cvsps()
return 0 return 0
;; ;;
-Z) -Z)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0 return 0
;; ;;
--root) --root)

View File

@ -11,7 +11,7 @@ _find()
case $prev in case $prev in
-maxdepth|-mindepth) -maxdepth|-mindepth)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return 0 return 0
;; ;;
-newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\ -newer|-anewer|-cnewer|-fls|-fprint|-fprint0|-fprintf|-name|-iname|\

View File

@ -40,8 +40,7 @@ _ipmitool()
return 0 return 0
;; ;;
-C) -C)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10 11 12 13 14' \ COMPREPLY=( $( compgen -W '{0..14}' -- "$cur" ) )
-- "$cur" ) )
return 0 return 0
;; ;;
-L) -L)

View File

@ -332,7 +332,7 @@ _pack200()
return 0 return 0
;; ;;
-E|--effort) -E|--effort)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return 0 return 0
;; ;;
-H|--deflate-hint) -H|--deflate-hint)

View File

@ -31,17 +31,15 @@ _lrzip()
return 0 return 0
;; ;;
-L) -L)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0 return 0
;; ;;
-T) -T)
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9 10' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..10}' -- "$cur" ) )
return 0 return 0
;; ;;
-N) -N)
COMPREPLY=( $( compgen -W '-20 -19 -18 -17 -16 -15 -14 -13 -12 \ COMPREPLY=( $( compgen -W '{-20..19}' -- "$cur" ) )
-11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7 8 9 10 11 \
12 13 14 15 16 17 18 19' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac

View File

@ -9,7 +9,7 @@ _mcrypt()
case $prev in case $prev in
-g|--openpgp-z) -g|--openpgp-z)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
return 0 return 0
;; ;;
-o|--keymode) -o|--keymode)

View File

@ -32,7 +32,7 @@ _rsync()
;; ;;
--compress-level) --compress-level)
compopt +o nospace compopt +o nospace
COMPREPLY=( $( compgen -W '1 2 3 4 5 6 7 8 9' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{1..9}' -- "$cur" ) )
return 0 return 0
;; ;;
esac esac

View File

@ -25,7 +25,7 @@ _samba_hosts()
_samba_debuglevel() _samba_debuglevel()
{ {
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- "$cur" ) ) COMPREPLY=( $( compgen -W '{0..10}' -- "$cur" ) )
} }
_smbclient() _smbclient()

View File

@ -10,22 +10,11 @@ _smartctl_device()
{ {
case $cur in case $cur in
areca*|3ware*|megaraid*|cciss*) areca*|3ware*|megaraid*|cciss*)
local i mycur="${cur%%,*}" COMPREPLY+=( ${cur%%,*},{0..31} )
for (( i=0; i <= 31; i++ )) ; do
COMPREPLY+=( "$mycur,$i" )
done
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
;; ;;
hpt*) hpt*)
local l m n COMPREPLY+=( hpt,{1..4}/{1..8} hpt,{1..4}/{1..8}/{1..5} )
for (( l=1; l <= 4; l++ )) ; do
for (( m=1; m <= 8; m++ )) ; do
COMPREPLY+=( hpt,$l/$m )
for (( n=1; n <= 5; n++ )) ; do
COMPREPLY+=( hpt,$l/$m/$n )
done
done
done
COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) ) COMPREPLY=( $( compgen -W '"${COMPREPLY[@]}"' -- "$cur" ) )
;; ;;
*) *)

View File

@ -52,8 +52,7 @@ _cdrecord()
awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) ) awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) )
;; ;;
minbuf) minbuf)
COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \ COMPREPLY=( $( compgen -W '{25..95}' -- "$cur" ) )
-- "$cur" ) )
;; ;;
esac esac
return 0 return 0