Use _split_longopt in heimdal.

This commit is contained in:
Ville Skyttä 2009-06-12 20:19:20 +03:00
parent eea696d9cc
commit 4956b5fef5
2 changed files with 23 additions and 47 deletions

View File

@ -64,9 +64,9 @@ 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, bluez-utils, chgrp, * Use _split_longopt to improve and clean up aspell, bluez-utils, chgrp,
chown, chkconfig, cpio, dpkg, iptables, make, mc, mii-diag, mii-tool, chown, chkconfig, cpio, dpkg, heimdal, iptables, make, mc, mii-diag,
mkinitrd, pkg-config, postgresql, quota, reportbug, samba, smartctl, yum, mii-tool, mkinitrd, pkg-config, postgresql, quota, reportbug, samba,
and generic long option completion (Alioth: #311398). smartctl, yum, 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

View File

@ -29,61 +29,38 @@ _heimdal_encodings()
_ktutil() _ktutil()
{ {
local cur prev command options local cur prev command options 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
-p) -p|--principal)
_heimdal_principals _heimdal_principals
return 0 return 0
;; ;;
-e) -e|--enctype)
_heimdal_encodings _heimdal_encodings
return 0 return 0
;; ;;
-a) -a|--admin-server)
_known_hosts _known_hosts
return 0 return 0
;; ;;
-r) -r|--realm)
_heimdal_realms _heimdal_realms
return 0 return 0
;; ;;
-@(s|k)) -@(s|k|-@(srv|key)tab))
_filedir _filedir
return 0 return 0
;; ;;
esac esac
if [[ "$cur" == *=* ]]; then $split && return 0
prev=${cur/=*/}
cur=${cur/*=/}
case "$prev" in
--principal)
_heimdal_principals
return 0
;;
--enctype)
_heimdal_encodings
return 0
;;
--admin-server)
_known_hosts
return 0
;;
--realm)
_heimdal_realms
return 0
;;
--@(srv|key)tab)
_filedir
return 0
;;
esac
fi
commands='add change copy get list remove rename purge srvconvert \ commands='add change copy get list remove rename purge srvconvert \
srv2keytab srvcreate key2srvtab' srv2keytab srvcreate key2srvtab'
@ -105,34 +82,33 @@ _ktutil()
if [[ "$cur" == -* ]]; then if [[ "$cur" == -* ]]; then
case $command in case $command in
add) add)
options='-p --principal= -V -e --enctype= -w \ options='-p --principal -V -e --enctype -w \
--password= -r --random -s --no-salt \ --password -r --random -s --no-salt \
-h --hex' -h --hex'
;; ;;
change) change)
options='-r --realm= -a --admin-server -s \ options='-r --realm -a --admin-server -s \
--server-port=' --server-port'
;; ;;
get) get)
options='-p --principal= -e --enctype= -r \ options='-p --principal -e --enctype -r \
--realm= -a --admin-server= -s server \ --realm -a --admin-server -s server \
--server-port=' --server-port'
;; ;;
list) list)
options='--keys --timestamp' options='--keys --timestamp'
;; ;;
remove) remove)
options='-p --principal= -V --kvno -e \ options='-p --principal -V --kvno -e --enctype'
--enctype='
;; ;;
purge) purge)
options='--age=' options='--age'
;; ;;
@(srv2keytab|key2srvtab)) @(srv2keytab|key2srvtab))
options='-s --srvtab=' options='-s --srvtab'
;; ;;
*) *)
options='-k --keytab= -v --verbose --version \ options='-k --keytab -v --verbose --version \
-v --help' -v --help'
;; ;;
esac esac