Use _split_longopt with cpio.
This commit is contained in:
parent
a375531c41
commit
29c9fc3df8
4
CHANGES
4
CHANGES
@ -38,8 +38,8 @@ bash-completion (1.x)
|
|||||||
* Add _split_longopt() helper for improved handling of long options that
|
* Add _split_longopt() helper for improved handling of long options that
|
||||||
take arguments in both "--foo bar" and "--foo=bar" formats.
|
take arguments in both "--foo bar" and "--foo=bar" formats.
|
||||||
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
* Use _split_longopt to improve and clean up aspell, chgrp, chown, chkconfig,
|
||||||
iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic long
|
cpio, iptables, make, mii-diag, mii-tool, mkinitrd, smartctl, and generic
|
||||||
option completion (Alioth: #311398).
|
long option completion (Alioth: #311398).
|
||||||
* Add chown --from and --reference value completions.
|
* Add chown --from and --reference value completions.
|
||||||
* Add chgrp --reference value completion.
|
* Add chgrp --reference value completion.
|
||||||
* Do not assume all --foo= options take filenames in generic long option
|
* Do not assume all --foo= options take filenames in generic long option
|
||||||
|
56
contrib/cpio
56
contrib/cpio
@ -11,42 +11,25 @@ _cpio_format()
|
|||||||
|
|
||||||
_cpio()
|
_cpio()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev split=false
|
||||||
|
|
||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||||
|
|
||||||
|
_split_longopt && split=true
|
||||||
|
|
||||||
# --name value style option
|
# --name value style option
|
||||||
case $prev in
|
case $prev in
|
||||||
-H)
|
-H|--format)
|
||||||
_cpio_format
|
_cpio_format
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-@(E|F|I))
|
-@(E|F|I|-?(pattern-)file))
|
||||||
_filedir
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
-R)
|
-R|--owner)
|
||||||
_usergroup
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --name=value style option
|
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case $prev in
|
|
||||||
--format)
|
|
||||||
_cpio_format
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
--@(file|pattern-file))
|
|
||||||
_filedir
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
--owner)
|
|
||||||
_usergroup
|
_usergroup
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
@ -55,7 +38,8 @@ _cpio()
|
|||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
|
$split && return 0
|
||||||
|
|
||||||
if [ $COMP_CWORD -eq 1 ]; then
|
if [ $COMP_CWORD -eq 1 ]; then
|
||||||
COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
|
COMPREPLY=( $( compgen -W '-o --create -i --extract -p --pass-through' -- $cur) )
|
||||||
@ -64,11 +48,11 @@ _cpio()
|
|||||||
-@(o|-create))
|
-@(o|-create))
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
|
COMPREPLY=( $( compgen -W '-0 -a -c -v -A -B\
|
||||||
-L -V -C -H -M -O -F --file= --format=\
|
-L -V -C -H -M -O -F --file --format\
|
||||||
--message= --null --reset-access-time\
|
--message --null --reset-access-time\
|
||||||
--verbose --dot --append --block-size=\
|
--verbose --dot --append --block-size\
|
||||||
--dereference --io-size= --quiet\
|
--dereference --io-size --quiet\
|
||||||
--force-local --rsh-command= --help\
|
--force-local --rsh-command --help\
|
||||||
--version' -- $cur ) )
|
--version' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -76,18 +60,18 @@ _cpio()
|
|||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
|
COMPREPLY=( $( compgen -W '-b -c -d -f -m -n -r\
|
||||||
-t -s -u -v -B -S -V -C -E -H -M -R -I\
|
-t -s -u -v -B -S -V -C -E -H -M -R -I\
|
||||||
-F --file= --make-directories\
|
-F --file --make-directories\
|
||||||
--nonmatching\
|
--nonmatching\
|
||||||
--preserve-modification-time\
|
--preserve-modification-time\
|
||||||
--numeric-uid-gid --rename -t --list\
|
--numeric-uid-gid --rename -t --list\
|
||||||
--swap-bytes --swap --dot\
|
--swap-bytes --swap --dot\
|
||||||
--unconditional --verbose --block-size=\
|
--unconditional --verbose --block-size\
|
||||||
--swap-halfwords --io-size=\
|
--swap-halfwords --io-size\
|
||||||
--pattern-file= --format= --owner=\
|
--pattern-file --format --owner\
|
||||||
--no-preserve-owner --message=\
|
--no-preserve-owner --message\
|
||||||
--force-local --no-absolute-filenames\
|
--force-local --no-absolute-filenames\
|
||||||
--sparse --only-verify-crc --quiet\
|
--sparse --only-verify-crc --quiet\
|
||||||
--rsh-command= --help\
|
--rsh-command --help\
|
||||||
--version' -- $cur ) )
|
--version' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -98,7 +82,7 @@ _cpio()
|
|||||||
--make-directories --link --quiet\
|
--make-directories --link --quiet\
|
||||||
--preserve-modification-time\
|
--preserve-modification-time\
|
||||||
--unconditional --verbose --dot\
|
--unconditional --verbose --dot\
|
||||||
--dereference --owner=\
|
--dereference --owner\
|
||||||
--no-preserve-owner --sparse --help\
|
--no-preserve-owner --sparse --help\
|
||||||
--version' -- $cur ) )
|
--version' -- $cur ) )
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user