--- bash_completion~ 2007-07-15 16:09:22.000000000 +0200 +++ bash_completion 2007-07-15 16:08:29.000000000 +0200 @@ -820,7 +820,7 @@ _man() # weed out directory path names and paths to man pages COMPREPLY=( ${COMPREPLY[@]##*/?(:)} ) # strip suffix from man pages - COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} ) + COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) [[ "$prev" != [0-9ln] ]] && _filedir '[0-9ln]' @@ -1997,7 +1997,7 @@ _rpm() elif [[ ${COMP_WORDS[1]} == -b* ]]; then _filedir 'spec' else - _filedir '@(tgz|tar.@(gz|bz2))' + _filedir '@(tgz|tar.@(gz|bz2|lzma))' fi ;; --re@(build|compile)) @@ -2009,7 +2009,7 @@ _rpm() fi ;; --tarbuild) - _filedir '@(tgz|tar.@(gz|bz2))' + _filedir '@(tgz|tar.@(gz|bz2|lzma))' ;; --@(re|add)sign) _filedir 'rpm' @@ -2882,9 +2882,9 @@ _tar() _filedir return 0 ;; - +([^IZzjy])f) - ext='t@(ar?(.@(Z|gz|bz?(2)))|gz|bz?(2))' - regex='t\(ar\(\.\(Z\|gz\|bz2\?\)\)\?\|gz\|bz2\?\)' + +([^IZzjyY])f) + ext='t@(ar?(.@(Z|gz|bz?(2)|lz?(ma)))|gz|bz?(2)|lz?(ma))' + regex='t\(ar\(\.\(Z\|gz\|bz2\?\|lzma\)\)\?\|gz\|bz2\?\|lzma\)' ;; *[Zz]*f) ext='t?(ar.)@(gz|Z)' @@ -2894,6 +2894,10 @@ _tar() ext='t?(ar.)bz?(2)' regex='t\(ar\.\)\?bz2\?' ;; + *[Y]*f) + ext='t?(ar.)lz?(ma)' + regex='t\(ar\.\)\?lzma\?' + ;; *) _filedir return 0 @@ -3391,6 +3395,44 @@ _bzip2() } && complete -F _bzip2 $filenames bzip2 +# lzma(1) completion +# +have lzma && +_lzma() +{ + local cur prev xspec + + OMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + + if [[ "$cur" == -* ]]; then + COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \ + -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \ + --help --decompress --compress --keep --force \ + --test --stdout --quiet --verbose --license \ + --version --small --fast --best --text' -- $cur ) ) + return 0 + fi + + xspec="*.lzma" + if [[ "$prev" == --* ]]; then + [[ "$prev" == --decompress || \ + "$prev" == --list || \ + "$prev" == --test ]] && xspec="!"$xspec + [[ "$prev" == --compress ]] && xspec= + elif [[ "$prev" == -* ]]; then + [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec + [[ "$prev" == -*z* ]] && xspec= + fi + + _expand || return 0 + + COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \ + $( compgen -d -- $cur ) ) +} && +complete -F _lzma $filenames lzma + # openssl(1) completion # have openssl && { @@ -6994,7 +7036,7 @@ _info() fi; done # strip suffix from info pages - COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2)} ) + COMPREPLY=( ${COMPREPLY[@]%.@(gz|bz2|lzma)} ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]%.*}' -- "${cur//\\\\/}" ) ) return 0