Use _split_longopt in samba completion, various option completion additions, fixes and improvements.
This commit is contained in:
parent
8534927443
commit
e96ef90c26
3
CHANGES
3
CHANGES
@ -39,7 +39,7 @@ bash-completion (1.x)
|
|||||||
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,
|
||||||
cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, postgresql,
|
cpio, iptables, make, mc, mii-diag, mii-tool, mkinitrd, postgresql,
|
||||||
smartctl, and generic long option completion (Alioth: #311398).
|
samba, smartctl, and generic 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
|
||||||
@ -50,6 +50,7 @@ bash-completion (1.x)
|
|||||||
tcpdump completions.
|
tcpdump completions.
|
||||||
* Split ant completion to contrib/ant, improve the built in one.
|
* Split ant completion to contrib/ant, improve the built in one.
|
||||||
* Improve postfix completion.
|
* Improve postfix completion.
|
||||||
|
* Improve samba completion.
|
||||||
|
|
||||||
[ Todd Zullinger ]
|
[ Todd Zullinger ]
|
||||||
* Make yum complete on filenames after install, deplist, update and upgrade
|
* Make yum complete on filenames after install, deplist, update and upgrade
|
||||||
|
161
contrib/samba
161
contrib/samba
@ -25,14 +25,21 @@ _samba_hosts()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_samba_debuglevel()
|
||||||
|
{
|
||||||
|
COMPREPLY=( $( compgen -W '0 1 2 3 4 5 6 7 8 9 10' -- $cur ) )
|
||||||
|
}
|
||||||
|
|
||||||
_smbclient()
|
_smbclient()
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-R)
|
-R)
|
||||||
_samba_resolve_order
|
_samba_resolve_order
|
||||||
@ -43,11 +50,11 @@ _smbclient()
|
|||||||
HEX CAP' -- $cur ) )
|
HEX CAP' -- $cur ) )
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-@(s|A))
|
-s|-A|--authentication-file)
|
||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-l)
|
-l|--log-basename|-D)
|
||||||
_filedir -d
|
_filedir -d
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
@ -63,59 +70,61 @@ _smbclient()
|
|||||||
$cur ) )
|
$cur ) )
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-W)
|
-W|--workgroup)
|
||||||
_samba_domains
|
_samba_domains
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-d|--debuglevel)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-p|--port|-M|-I|-b|-U|--user|-n|-i|-T|-c)
|
||||||
|
# argument required but no completions available
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-\?|--help|-V|--version)
|
||||||
|
# all other arguments are noop with these
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# --name=value style option
|
$split && return 0
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case $prev in
|
|
||||||
--logfile)
|
|
||||||
_filedir -d
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
--authentication-file)
|
|
||||||
_filedir
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
--workgroup)
|
|
||||||
_samba_domains
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
|
COMPREPLY=( $( compgen -W '-b -d -L -U -I -M -m -A -N -i -O \
|
||||||
-p -R -s -k -P -c -D -W -l -E --debuglevel= --logfile= \
|
-p -R -s -k -P -c -D -W -l -E --debuglevel \
|
||||||
--workgroup=' -- $cur ) )
|
--log-basename --workgroup' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
complete -F _smbclient smbclient
|
complete -F _smbclient smbclient
|
||||||
|
|
||||||
_smbget()
|
_smbget()
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-@(o|f|-outputfile|-rcfile))
|
-@(o|f|-outputfile|-rcfile))
|
||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-d|--debuglevel)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
$split && return 0
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-a --guest -r --resume -R \
|
COMPREPLY=( $( compgen -W '-a --guest -r --resume -R \
|
||||||
--recursive -u --username= -p --password= -w \
|
--recursive -u --username -p --password -w \
|
||||||
--workgroup= -n --nonprompt -d --debuglevel= -D --dots \
|
--workgroup -n --nonprompt -d --debuglevel -D --dots \
|
||||||
-P --keep-permissions -o --outputfile -f --rcfile -q \
|
-P --keep-permissions -o --outputfile -f --rcfile -q \
|
||||||
--quiet -v --verbose -b --blocksize -? --help --usage' \
|
--quiet -v --verbose -b --blocksize -? --help --usage' \
|
||||||
-- $cur ) )
|
-- $cur ) )
|
||||||
@ -125,38 +134,34 @@ complete -F _smbget smbget
|
|||||||
|
|
||||||
_smbcacls()
|
_smbcacls()
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-s)
|
-s)
|
||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-l)
|
-l|--log-basename)
|
||||||
_filedir -d
|
_filedir -d
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-d|--debuglevel)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# --name=value style option
|
$split && return 0
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case $prev in
|
|
||||||
--logfile)
|
|
||||||
_filedir -d
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
|
COMPREPLY=( $( compgen -W '-a -M -D -S -U -C -G --numeric -t \
|
||||||
-h --help -V -s -d --debuglevel= -l --logfile=' -- \
|
-h --help -V -s -d --debuglevel -l --log-basename' -- \
|
||||||
$cur ) )
|
$cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -164,43 +169,35 @@ complete -F _smbcacls smbcacls
|
|||||||
|
|
||||||
_smbcquotas()
|
_smbcquotas()
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-@(s|A))
|
-s|-A|--authentication-file)
|
||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-l)
|
-l|--log-basename)
|
||||||
_filedir -d
|
_filedir -d
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-d|--debuglevel)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# --name=value style option
|
$split && return 0
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case $prev in
|
|
||||||
--logfile)
|
|
||||||
_filedir -d
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
--authentication-file)
|
|
||||||
_filedir
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
|
COMPREPLY=( $( compgen -W '-u -L -F -S -n -t -v -h --help -V \
|
||||||
-s -d --debuglevel= -l --logfile= -N -k -A \
|
-s -d --debuglevel -l --log-basename -N -k -A \
|
||||||
--authentication-file= -U --user=' -- $cur ) )
|
--authentication-file -U --user' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
complete -F _smbcquotas smbcquotas
|
complete -F _smbcquotas smbcquotas
|
||||||
@ -226,6 +223,10 @@ _smbpasswd()
|
|||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-D)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
@ -252,6 +253,10 @@ _smbtar()
|
|||||||
_samba_hosts
|
_samba_hosts
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-l)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
@ -263,42 +268,34 @@ complete -F _smbtar smbtar
|
|||||||
|
|
||||||
_smbtree()
|
_smbtree()
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-@(s|A))
|
-s|-A|--authentication-file)
|
||||||
_filedir
|
_filedir
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
-l)
|
-l|--log-basename)
|
||||||
_filedir -d
|
_filedir -d
|
||||||
return 0;
|
return 0;
|
||||||
;;
|
;;
|
||||||
|
-d|--debuglevel)
|
||||||
|
_samba_debuglevel
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# --name=value style option
|
$split && return 0
|
||||||
if [[ "$cur" == *=* ]]; then
|
|
||||||
prev=${cur/=*/}
|
|
||||||
cur=${cur/*=/}
|
|
||||||
case $prev in
|
|
||||||
--logfile)
|
|
||||||
_filedir -d
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
--authentication-file)
|
|
||||||
_filedir
|
|
||||||
return 0;
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel= -l \
|
COMPREPLY=( $( compgen -W '-b -D -S -V -s -d --debuglevel -l \
|
||||||
--logfile= -N -k -A --authentication-file= -U --user= \
|
--log-basename -N -k -A --authentication-file -U --user\
|
||||||
-h --help' -- $cur ) )
|
-h --help' -- $cur ) )
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user