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
;;
-d|-e)
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
COMPREPLY=( $( compgen -W '{0..10}' -- $cur ) )
;;
-c)
_filedir

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,7 +9,7 @@ _mcrypt()
case $prev in
-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
;;
-o|--keymode)

View File

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

View File

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

View File

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

View File

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