diff --git a/bash_completion b/bash_completion index 591e1da5..70591f15 100644 --- a/bash_completion +++ b/bash_completion @@ -774,11 +774,13 @@ _parse_help() # Expand --[no]foo to --foo and --nofoo if [[ $option == *\[no\]?* ]]; then option2=${option/\[no\]/} - printf '%s\n' "${option2%%[=<{[]*}" + option2=${option2%%[<{[]*} + printf '%s\n' "${option2/=*/=}" option=${option/\[no\]/no} fi - printf '%s\n' "${option%%[=<{[]*}" + option=${option%%[<{[]*} + printf '%s\n' "${option/=*/=}" done } @@ -1678,8 +1680,9 @@ _longopt() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$( $1 --help 2>&1 | \ - sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}\).*/\1/p' | sort -u )" \ + sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\?\).*/\1/p' | sort -u )" \ -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ "$1" == @(mk|rm)dir ]]; then compopt +o default _filedir -d diff --git a/completions/_mock b/completions/_mock index d4a26de2..55d7a0f2 100644 --- a/completions/_mock +++ b/completions/_mock @@ -61,6 +61,7 @@ _mock() if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir '@(?(no)src.r|s)pm' fi diff --git a/completions/_yum b/completions/_yum index 6caf21b0..cf31da80 100644 --- a/completions/_yum +++ b/completions/_yum @@ -137,6 +137,7 @@ _yum() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && diff --git a/completions/aspell b/completions/aspell index a0c861c6..ae5b3366 100644 --- a/completions/aspell +++ b/completions/aspell @@ -60,27 +60,28 @@ _aspell() $split && return 0 if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--conf --conf-dir --data-dir --dict-dir \ - --encoding --add-filter --rem-filter --mode \ - --add-extra-dicts --rem-extra-dicts \ - --home-dir --ignore --ignore-accents \ + COMPREPLY=( $( compgen -W '--conf= --conf-dir= --data-dir= --dict-dir= \ + --encoding= --add-filter= --rem-filter= --mode= \ + --add-extra-dicts= --rem-extra-dicts= \ + --home-dir= --ignore= --ignore-accents \ --dont-ignore-accents --ignore-case --dont-ignore-case \ - --ignore-repl --dont-ignore-repl --jargon --keyboard \ - --lang --language-tag --local-data-dir --master \ + --ignore-repl --dont-ignore-repl --jargon --keyboard= \ + --lang= --language-tag --local-data-dir= --master= \ --module --add-module-search-order \ - --rem-module-search-order --per-conf --personal \ - --prefix --repl --run-together --dont-run-together \ - --run-together-limit --run-together-min --save-repl \ - --dont-save-repl --set-prefix --dont-set-prefix --size \ + --rem-module-search-order --per-conf= --personal= \ + --prefix= --repl= --run-together --dont-run-together \ + --run-together-limit= --run-together-min= --save-repl \ + --dont-save-repl --set-prefix --dont-set-prefix --size= \ --spelling --strip-accents --dont-strip-accents \ - --sug-mode --add-word-list-path --rem-word-list-path \ + --sug-mode= --add-word-list-path --rem-word-list-path \ --backup --dont-backup --reverse --dont-reverse \ - --time --dont-time --keymapping --add-email-quote \ - --rem-email-quote --email-margin --add-tex-command \ - --rem-tex-command --tex-check-comments \ + --time --dont-time --keymapping= --add-email-quote= \ + --rem-email-quote= --email-margin= --add-tex-command= \ + --rem-tex-command= --tex-check-comments \ --dont-tex-check-comments --add-tex-extension \ - --rem-tex-extension --add-sgml-check --rem-sgml-check \ + --rem-tex-extension --add-sgml-check= --rem-sgml-check= \ --add-sgml-extension --rem-sgml-extension' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else COMPREPLY=( $( compgen -W 'usage help check pipe list \ config soundslike filter version dump create merge' -- "$cur" ) ) diff --git a/completions/autoconf b/completions/autoconf index 716755b6..ba6dd185 100644 --- a/completions/autoconf +++ b/completions/autoconf @@ -30,6 +30,7 @@ _autoconf() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -64,6 +65,7 @@ _autoreconf() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi @@ -95,6 +97,7 @@ _autoscan() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/completions/automake b/completions/automake index cb705308..2080f252 100644 --- a/completions/automake +++ b/completions/automake @@ -26,6 +26,7 @@ _automake() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi @@ -62,6 +63,7 @@ _aclocal() $split && return 0 COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _aclocal aclocal aclocal-1.11 diff --git a/completions/configure b/completions/configure index 285edb3d..af1c736a 100644 --- a/completions/configure +++ b/completions/configure @@ -33,8 +33,10 @@ _configure() awk '/^ --[A-Za-z]/ { print $1; \ if ($2 ~ /--[A-Za-z]/) print $2 }' | sed -e 's/[[,].*//g' )" \ -- "$cur" ) ) + [[ $COMPREPLY == *=* ]] && compopt -o nospace else COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && complete -F _configure configure diff --git a/completions/coreutils b/completions/coreutils index d1928ec8..d4a5558d 100644 --- a/completions/coreutils +++ b/completions/coreutils @@ -129,6 +129,7 @@ _mktemp() local opts=$( _parse_help "$1" ) [[ $opts ]] || opts="-d -u -q -p -t" # non-GNU fallback COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace fi } && complete -F _mktemp mktemp diff --git a/completions/cryptsetup b/completions/cryptsetup index 1fe1d70f..9b29a548 100644 --- a/completions/cryptsetup +++ b/completions/cryptsetup @@ -33,6 +33,7 @@ _cryptsetup() if [ -z $arg ]; then if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else COMPREPLY=( $( compgen -W 'create remove status resize luksFormat \ luksOpen luksClose luksSuspend luksResume luksAddKey \ diff --git a/completions/cvs b/completions/cvs index 0a397a48..9570f855 100644 --- a/completions/cvs +++ b/completions/cvs @@ -283,6 +283,7 @@ _cvs() diff) if [[ "$cur" == -* ]]; then _cvs_command_options "$1" $mode + [[ $COMPREPLY == *= ]] && compopt -o nospace else get_entries COMPREPLY=( $( compgen -W '${entries[@]:-}' -- "$cur" ) ) diff --git a/completions/dpkg b/completions/dpkg index ee78f998..d6ae6bc9 100644 --- a/completions/dpkg +++ b/completions/dpkg @@ -58,12 +58,12 @@ _dpkg() COMPREPLY=( $( _comp_dpkg_installed_packages "$cur" ) ) return 0 ;; - *) - COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) - ;; esac + $split && return + COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _dpkg dpkg dpkg-deb } diff --git a/completions/getent b/completions/getent index 5ba3fcdd..012c229a 100644 --- a/completions/getent +++ b/completions/getent @@ -68,6 +68,7 @@ _getent() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace elif [[ -z $db ]]; then COMPREPLY=( $( compgen -W 'passwd group hosts services protocols \ networks ahosts ahostsv4 ahostsv6 aliases ethers netgroup rpc \ diff --git a/completions/gzip b/completions/gzip index 3913c83b..3b33de11 100644 --- a/completions/gzip +++ b/completions/gzip @@ -16,6 +16,7 @@ _gzip() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" ) {-1..-9}' \ -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/completions/iconv b/completions/iconv index ed060673..16e39037 100644 --- a/completions/iconv +++ b/completions/iconv @@ -27,6 +27,7 @@ _iconv() if [[ "$cur" = -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && diff --git a/completions/info b/completions/info index cdc851fd..ee2b7a57 100644 --- a/completions/info +++ b/completions/info @@ -33,6 +33,7 @@ _info() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/java b/completions/java index bf3bee4b..f848cae7 100644 --- a/completions/java +++ b/completions/java @@ -493,7 +493,7 @@ have javaws && _javaws() { local cur prev words cword - _init_completion || return + _init_completion -n = || return case $prev in -help|-license|-about|-viewer|-arg|-param|-property|-update|-umask) @@ -509,8 +509,11 @@ _javaws() ;; esac - if [[ $cur == -* ]]; then + if [[ $cur == *= ]]; then + return 0 + elif [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" -help ) " -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/completions/k3b b/completions/k3b index 56b6c114..9f41ed5c 100644 --- a/completions/k3b +++ b/completions/k3b @@ -40,6 +40,7 @@ _k3b() if [[ "$cur" == -* ]] ; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir fi diff --git a/completions/man b/completions/man index 1b3ae4e0..0fa17a0d 100644 --- a/completions/man +++ b/completions/man @@ -42,6 +42,7 @@ _man() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return fi diff --git a/completions/mc b/completions/mc index cec0c4d9..27ddc0a0 100644 --- a/completions/mc +++ b/completions/mc @@ -27,6 +27,7 @@ _mc() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --help-all )' \ -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _filedir -d fi diff --git a/completions/mdadm b/completions/mdadm index c91671c9..19647e08 100644 --- a/completions/mdadm +++ b/completions/mdadm @@ -102,7 +102,7 @@ _mdadm() local options options='--help --help-options --version --verbose --quiet \ - --brief --force --config --scan --metadata --homehost' + --brief --force --config= --scan --metadata= --homehost=' if [[ "$cur" == -* ]]; then if [[ $cword -eq 1 ]] ; then @@ -111,18 +111,18 @@ _mdadm() else case ${words[cword-1]} in -A|--assemble) - COMPREPLY=( $( compgen -W "$options --uuid \ - --super-minor --name --force --run \ - --no-degraded --auto --bitmap --backup-file \ - --update --auto-update-homehost" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$options --uuid= \ + --super-minor= --name= --force --run \ + --no-degraded --auto= --bitmap= --backup-file= \ + --update= --auto-update-homehost" -- "$cur" ) ) ;; -B|-C|-G|--build|--create|--grow) - COMPREPLY=( $( compgen -W "$options --raid-devices \ - --spare-devices --size --chunk --rounding \ - --level --layout --parity --bitmap \ - --bitmap-chunk --write-mostly --write-behind \ - --assume-clean --backup-file --name --run \ - --force --auto" -- "$cur" ) ) + COMPREPLY=( $( compgen -W "$options --raid-devices= \ + --spare-devices= --size= --chunk= --rounding= \ + --level= --layout= --parity= --bitmap= \ + --bitmap-chunk= --write-mostly --write-behind= \ + --assume-clean --backup-file= --name= --run \ + --force --auto=" -- "$cur" ) ) ;; -F|--follow|--monitor) COMPREPLY=( $( compgen -W "$options --mail --program \ @@ -142,6 +142,7 @@ _mdadm() ;; esac fi + [[ $COMPREPLY == *= ]] && compopt -o nospace else cur=${cur:=/dev/} _filedir diff --git a/completions/mkinitrd b/completions/mkinitrd index d087b75e..9efdf8e5 100644 --- a/completions/mkinitrd +++ b/completions/mkinitrd @@ -28,9 +28,10 @@ _mkinitrd() COMPREPLY=( $( compgen -W '--version --help -v -f --preload \ --force-scsi-probe --omit-scsi-modules \ --omit-ide-modules --image-version --force-raid-probe \ - --omit-raid-modules --with --force-lvm-probe \ + --omit-raid-modules --with= --force-lvm-probe \ --omit-lvm-modules --builtin --omit-dmraid --net-dev \ --fstab --nocompress --dsdt --bootchart' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else local args _count_args diff --git a/completions/mysqladmin b/completions/mysqladmin index 52a58973..b14a90bb 100644 --- a/completions/mysqladmin +++ b/completions/mysqladmin @@ -49,6 +49,8 @@ _mysqladmin() flush-logs flush-status flush-tables flush-threads flush-privileges \ kill password old-password ping processlist reload refresh shutdown \ status start-slave stop-slave variables version' -- "$cur" ) ) + + [[ $COMPREPLY == *= ]] && compopt -o nospace } && complete -F _mysqladmin mysqladmin diff --git a/completions/net-tools b/completions/net-tools index 53e90065..646b282c 100644 --- a/completions/net-tools +++ b/completions/net-tools @@ -23,6 +23,7 @@ _mii_tool() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _available_interfaces -a fi diff --git a/completions/pkg-config b/completions/pkg-config index 181e082d..b30fa557 100644 --- a/completions/pkg-config +++ b/completions/pkg-config @@ -23,6 +23,7 @@ _pkg_config() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else COMPREPLY=( $( compgen -W "$( pkg-config --list-all \ 2>/dev/null | awk '{print $1}' )" -- "$cur" ) ) diff --git a/completions/postgresql b/completions/postgresql index 15bef857..e3c3d122 100644 --- a/completions/postgresql +++ b/completions/postgresql @@ -48,6 +48,7 @@ _createdb() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _pg_databases fi @@ -80,6 +81,7 @@ _dropdb() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else _pg_databases fi @@ -126,6 +128,7 @@ _psql() if [[ "$cur" == -* ]]; then # return list of available options COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else # return list of available databases _pg_databases diff --git a/completions/rpm b/completions/rpm index a95f3bca..3984524c 100644 --- a/completions/rpm +++ b/completions/rpm @@ -116,8 +116,8 @@ _rpm() $split && return 0 # options common to all modes - local opts="--define --eval --macros --nodigest --nosignature --rcfile \ - --quiet --pipe --verbose" + local opts="--define= --eval= --macros= --nodigest --nosignature \ + --rcfile= --quiet --pipe --verbose" case ${words[1]} in -[iFU]*|--install|--freshen|--upgrade) @@ -125,10 +125,10 @@ _rpm() COMPREPLY=( $( compgen -W "$opts --percent --force \ --test --replacepkgs --replacefiles --root \ --excludedocs --includedocs --noscripts --ignorearch \ - --dbpath --prefix --ignoreos --nodeps --allfiles \ + --dbpath --prefix= --ignoreos --nodeps --allfiles \ --ftpproxy --ftpport --justdb --httpproxy --httpport \ - --noorder --relocate --badreloc --notriggers \ - --excludepath --ignoresize --oldpackage \ + --noorder --relocate= --badreloc --notriggers \ + --excludepath= --ignoresize --oldpackage \ --queryformat --repackage --nosuggests" -- "$cur" ) ) else _filedir '[rs]pm' @@ -148,7 +148,7 @@ _rpm() opts+=" --changelog --configfiles --conflicts --docfiles --dump --enhances --filesbypkg --filecaps --fileclass --filecolor --fileprovide --filerequire --filesbypkg --info - --list --obsoletes --pipe --provides --queryformat --rcfile + --list --obsoletes --pipe --provides --queryformat= --requires --scripts --suggests --triggers --xml" if [[ ${words[@]} == *\ -@(*([^ -])f|-file )* ]]; then @@ -175,7 +175,7 @@ _rpm() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W "$opts --all --file --fileid --dbpath --fscontext --ftswalk --group --hdrid --last - --package --pkgid --root --specfile --state + --package --pkgid --root= --specfile --state --triggeredby --whatprovides --whatrequires" \ -- "$cur" ) ) elif [[ ${words[@]} != *\ -@(*([^ -])a|-all )* ]]; then @@ -193,7 +193,7 @@ _rpm() ;; -[Vy]*|--verify) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W "$opts --root --dbpath --nodeps \ + COMPREPLY=( $( compgen -W "$opts --root= --dbpath --nodeps \ --nogroup --nolinkto --nomode --nomtime --nordev --nouser \ --nofiles --noscripts --nomd5 --querytags --specfile \ --whatrequires --whatprovides" -- "$cur" ) ) @@ -216,13 +216,14 @@ _rpm() ;; --import|--dbpath|--root) if [[ "$cur" == -* ]]; then - COMPREPLY=( $( compgen -W '--import --dbpath --root' \ + COMPREPLY=( $( compgen -W '--import --dbpath --root=' \ -- "$cur" ) ) else _filedir fi ;; esac + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 } && @@ -271,6 +272,7 @@ _rpmbuild() if [[ $cur == -* ]]; then COMPREPLY=( $( compgen -W "$( _parse_help "$1" )" -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/completions/shadow b/completions/shadow index c65a980f..de78c592 100644 --- a/completions/shadow +++ b/completions/shadow @@ -167,6 +167,7 @@ _chpasswd() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && @@ -193,6 +194,7 @@ _newusers() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi @@ -234,6 +236,7 @@ _groupadd() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && @@ -258,6 +261,7 @@ _groupmod() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi @@ -382,6 +386,7 @@ _faillog() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && @@ -407,6 +412,7 @@ _lastlog() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi } && diff --git a/completions/smartctl b/completions/smartctl index 14ebe431..e950f875 100644 --- a/completions/smartctl +++ b/completions/smartctl @@ -154,10 +154,12 @@ _smartctl() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '--help --version --info --all --xall - --scan --scan-open --quietmode --device --tolerance --badsum - --report --nocheck --smart --offlineauto --saveauto --health - --capabilities --attributes --log --vendorattribute --firmwarebug - --presets --drivedb --test --captive --abort' -- "$cur" ) ) + --scan --scan-open --quietmode= --device= --tolerance= --badsum= + --report= --nocheck= --smart= --offlineauto= --saveauto= --health + --capabilities --attributes --log= --vendorattribute= + --firmwarebug= --presets= --drivedb= --test= --captive --abort' \ + -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace else cur=${cur:=/dev/} _filedir diff --git a/completions/sysbench b/completions/sysbench index 8db9b3c9..82a0136b 100644 --- a/completions/sysbench +++ b/completions/sysbench @@ -116,15 +116,12 @@ _sysbench() fi done - # Long options need the "=" (whitespace split doesn't work), so we - # include it in completions that require a value. - local opts="--num-threads= --max-requests= --max-time= --thread-stack-size= --init-rng= --debug= --validate= --help --version" if [[ $test ]]; then local help=( $( _parse_help "$1" "--test=$test help" ) ) - opts+=" ${help[@]/%/=} prepare run cleanup help version" + opts+=" ${help[@]} prepare run cleanup help version" else opts+=" --test=" fi diff --git a/completions/wol b/completions/wol index 23b603f4..001e2f61 100644 --- a/completions/wol +++ b/completions/wol @@ -29,6 +29,7 @@ _wol() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/completions/wvdial b/completions/wvdial index 555a6381..4a2620c3 100644 --- a/completions/wvdial +++ b/completions/wvdial @@ -21,6 +21,7 @@ _wvdial() case $cur in -*) COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace ;; *) # start with global and personal config files diff --git a/completions/xz b/completions/xz index a438ecad..80a70dd8 100644 --- a/completions/xz +++ b/completions/xz @@ -9,6 +9,7 @@ _xz() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" --long-help ) {-1..-9}' \ -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi @@ -62,6 +63,7 @@ _xzdec() if [[ "$cur" == -* ]]; then COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) ) + [[ $COMPREPLY == *= ]] && compopt -o nospace return 0 fi diff --git a/test/unit/_parse_help.exp b/test/unit/_parse_help.exp index 460c9586..c746b651 100644 --- a/test/unit/_parse_help.exp +++ b/test/unit/_parse_help.exp @@ -50,15 +50,15 @@ assert_bash_list "-one" $cmd "internal dash 2" sync_after_int set cmd {fn() { printf '%s\n' "--long-arg=value"; }; _parse_help fn} -assert_bash_list "--long-arg" $cmd "value stripped" +assert_bash_list "--long-arg=" $cmd "value stripped" sync_after_int set cmd {fn() { printf '%s\n' "--long-arg=-value"; }; _parse_help fn} -assert_bash_list "--long-arg" $cmd "value not seen as option" +assert_bash_list "--long-arg=" $cmd "value not seen as option" sync_after_int set cmd {fn() { printf '%s\n' "--long-arg=-value,--opt2=val"; }; _parse_help fn} -assert_bash_list "--long-arg" $cmd "two options with values" +assert_bash_list "--long-arg=" $cmd "two options with values" sync_after_int set cmd {fn() { printf '%s\n' "-m,--mirror"; }; _parse_help fn} @@ -82,11 +82,11 @@ assert_bash_list "--foo" $cmd "long with value and eq sign in brackets" sync_after_int set cmd {fn() { printf '%s\n' "--foo="; }; _parse_help fn} -assert_bash_list "--foo" $cmd "long with value in angle brackets" +assert_bash_list "--foo=" $cmd "long with value in angle brackets" sync_after_int set cmd {fn() { printf '%s\n' "--foo={bar,quux}"; }; _parse_help fn} -assert_bash_list "--foo" $cmd "long with value in curly brackets" +assert_bash_list "--foo=" $cmd "long with value in curly brackets" sync_after_int set cmd {fn() { printf '%s\n' "--[no]foo"; }; _parse_help fn}