nospace usage cleanups.

This commit is contained in:
Ville Skyttä 2011-04-21 12:53:32 +03:00
parent aa411dd30b
commit 448106b098
2 changed files with 7 additions and 44 deletions

View File

@ -1,9 +1,5 @@
# bash completion for sysbench # bash completion for sysbench
# We set -o nospace and turn it off in quite a few places for bash < 4
# reasons; assuming bash >= 4 we could instead not turn it on
# initially but only in the few cases where it's actually needed.
have sysbench || return have sysbench || return
_sysbench() _sysbench()
@ -22,12 +18,10 @@ _sysbench()
return 0 return 0
;; ;;
--init-rng|--debug|--validate) --init-rng|--debug|--validate)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0 return 0
;; ;;
--test) --test)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \ COMPREPLY=( $( compgen -W 'fileio cpu memory threads mutex oltp' \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
@ -36,98 +30,80 @@ _sysbench()
return 0 return 0
;; ;;
--file-test-mode) --file-test-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \ COMPREPLY=( $( compgen -W 'seqwr seqrewr seqrd rndrd rndwr rndrw' \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
;; ;;
--file-io-mode) --file-io-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \ COMPREPLY=( $( compgen -W 'sync async fastmmap slowmmap' \
-- "$cur" ) ) -- "$cur" ) )
return 0 return 0
;; ;;
--file-extra-flags) --file-extra-flags)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'sync dsync direct' -- "$cur" ) )
return 0 return 0
;; ;;
--file-fsync-all|--file-fsync-end) --file-fsync-all|--file-fsync-end)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0 return 0
;; ;;
--file-fsync-mode) --file-fsync-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'fsync fdatasync' -- "$cur" ) )
return 0 return 0
;; ;;
--memory-scope) --memory-scope)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'global local' -- "$cur" ) )
return 0 return 0
;; ;;
--memory-hugetlb) --memory-hugetlb)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0 return 0
;; ;;
--memory-oper) --memory-oper)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'read write none' -- "$cur" ) )
return 0 return 0
;; ;;
--memory-access-mode) --memory-access-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'seq rnd' -- "$cur" ) )
return 0 return 0
;; ;;
--oltp-test-mode) --oltp-test-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'simple complex nontrx sp' -- "$cur" ) )
return 0 return 0
;; ;;
--oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl) --oltp-read-only|--oltp-skip-trx|--oltp-quto-inc|--mysql-ssl)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
return 0 return 0
;; ;;
--oltp-nontrx-mode) --oltp-nontrx-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'select update_key update_nokey insert COMPREPLY=( $( compgen -W 'select update_key update_nokey insert
delete' -- "$cur" ) ) delete' -- "$cur" ) )
return 0 return 0
;; ;;
--oltp-dist-type) --oltp-dist-type)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'uniform gaussian special' -- "$cur" ) )
return 0 return 0
;; ;;
--db-driver) --db-driver)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null | COMPREPLY=( $( compgen -W "$( $1 --test=oltp help 2>/dev/null |
sed -e '/^.*database drivers:/,/^$/!d' \ sed -e '/^.*database drivers:/,/^$/!d' \
-ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) ) -ne 's/^ *\([^ ]*\) .*/\1/p' )" -- "$cur" ) )
return 0 return 0
;; ;;
--db-ps-mode) --db-ps-mode)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'auto disable' -- "$cur" ) )
return 0 return 0
;; ;;
--mysql-socket) --mysql-socket)
compopt +o nospace &>/dev/null
_filedir sock _filedir sock
return 0 return 0
;; ;;
--mysql-table-engine) --mysql-table-engine)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster COMPREPLY=( $( compgen -W 'myisam innodb bdb heap ndbcluster
federated' -- "$cur" ) ) federated' -- "$cur" ) )
return 0 return 0
;; ;;
--mysql-engine-trx) --mysql-engine-trx)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) ) COMPREPLY=( $( compgen -W 'yes no auto' -- "$cur" ) )
return 0 return 0
;; ;;
@ -157,15 +133,14 @@ _sysbench()
if [[ "$cur" == -* || ! $test ]]; then if [[ "$cur" == -* || ! $test ]]; then
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
compopt +o nospace &>/dev/null compopt -o nospace
else else
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "prepare run cleanup help version" \ COMPREPLY=( $( compgen -W "prepare run cleanup help version" \
-- "$cur" ) ) -- "$cur" ) )
fi fi
} && } &&
complete -F _sysbench -o nospace sysbench complete -F _sysbench sysbench
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script

View File

@ -1,9 +1,5 @@
# bash completion for cdrecord/wodim # bash completion for cdrecord/wodim
# We set -o nospace and turn it off in several places for bash < 4
# reasons; assuming bash >= 4 we could instead not turn it on
# initially but only in the few cases where it's actually needed.
have cdrecord || have wodim || return have cdrecord || have wodim || return
_cdrecord() _cdrecord()
@ -19,11 +15,9 @@ _cdrecord()
cur=${cur#*=} cur=${cur#*=}
case $prev in case $prev in
textfile|cuefile|msifile) textfile|cuefile|msifile)
compopt +o nospace &>/dev/null
_filedir _filedir
;; ;;
blank) blank)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail COMPREPLY=( $( compgen -W 'help all fast track unreserve trtail
unclose session' -- "$cur" ) ) unclose session' -- "$cur" ) )
;; ;;
@ -33,17 +27,14 @@ _cdrecord()
cur=${cur#*=} cur=${cur#*=}
case $prev in case $prev in
varirec) varirec)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \ COMPREPLY=( $( compgen -W "-2 -1 0 1 2" \
-- "$cur" ) ) -- "$cur" ) )
;; ;;
gigarec) gigarec)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3 COMPREPLY=( $( compgen -W "0.6 0.7 0.8 1.0 1.2 1.3
1.4" -- "$cur" ) ) 1.4" -- "$cur" ) )
;; ;;
tattoofile) tattoofile)
compopt +o nospace &>/dev/null
_filedir _filedir
;; ;;
esac esac
@ -52,17 +43,15 @@ _cdrecord()
gigarec= audiomaster forcespeed noforcespeed speedread gigarec= audiomaster forcespeed noforcespeed speedread
nospeedread singlesession nosinglesession hidecdr nospeedread singlesession nosinglesession hidecdr
nohidecdr tattooinfo tattoofile=' -- "$cur" ) ) nohidecdr tattooinfo tattoofile=' -- "$cur" ) )
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || \
compopt +o nospace &>/dev/null compopt -o nospace
fi fi
;; ;;
driver) driver)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \ COMPREPLY=( $( compgen -W "$( $1 driver=help 2>&1 | \
awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) ) awk 'NR > 1 { print $1 }' ) help" -- "$cur" ) )
;; ;;
minbuf) minbuf)
compopt +o nospace &>/dev/null
COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \ COMPREPLY=( $( compgen -W "$( seq 25 95 2>/dev/null )" \
-- "$cur" ) ) -- "$cur" ) )
;; ;;
@ -103,10 +92,9 @@ _cdrecord()
if [ $track_mode -eq 0 ]; then if [ $track_mode -eq 0 ]; then
COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) ) COMPREPLY+=( $( compgen -W '${generic_options[@]}' -- "$cur" ) )
fi fi
[[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] && \ [[ ${#COMPREPLY[@]} -eq 1 && ${COMPREPLY[0]} != *= ]] || compopt -o nospace
compopt +o nospace &>/dev/null
} && } &&
complete -F _cdrecord -o nospace cdrecord wodim complete -F _cdrecord cdrecord wodim
# Local variables: # Local variables:
# mode: shell-script # mode: shell-script