From 09b6959aa5216813dbe66400e7df73ab83074986 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 7 Jun 2018 17:30:57 +0200 Subject: 43943: update samba completion with long options --- Completion/Unix/Command/_samba | 173 +++++++++++++++++++++++------------------ 1 file changed, 96 insertions(+), 77 deletions(-) (limited to 'Completion/Unix') diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba index faad69ba4..9a2fea9d6 100644 --- a/Completion/Unix/Command/_samba +++ b/Completion/Unix/Command/_samba @@ -1,93 +1,112 @@ #compdef smbcontrol smbclient nmblookup smbstatus -local expl msgs args +local curcontext="$curcontext" ret=1 +local -a state line expl msgs args ign + +(( CURRENT == 2 )) || ign='!' +args=( + '(-d --debuglevel)'{-d+,--debuglevel=}'[set debug level]:debug level (1..10) [1]' + '(-s --configfile)'{-s+,--configfile=}'[specify alternate smb.conf file]:config file:_files' + '(-l --log-basename)'{-l+,--log-basename=}'[specify base name for log files]:base name:_files' + '*--option=[set smb.conf option from command line]:option=value' + "${ign}(1 2 3 -)"{-\?,--help}'[display usage information]' + "${ign}(1 2 3 -)--usage[display brief usage information]" + "${ign}(1 2 3 - *)"{-V,--version}'[display version information]' +) case $service in smbcontrol) - case $CURRENT in - 3) - msgs=( debug ping profile debuglevel profilelevel ) - case $words[CURRENT-1] in - nmbd) msgs=( $msgs force-election ) ;; - smbd) msgs=( $msgs printer-notify ) ;; - -i) return 1 ;; - esac - _wanted message-type expl 'message types' compadd -a msgs - ;; - 4) - case $words[CURRENT-1] in - profile) - _wanted parameter expl 'parameter' compadd on off flush count - ;; - debug) _message -e levels 'debug level' ;; - ping) _message -e numbers 'number of ping messages' ;; - esac + _arguments -C -S $args \ + '(-t --timeout)'{-t+,--timeout=}'[set timeout]:timeout (seconds)' \ + ':destination:(all nmbd smbd winbindd)' \ + ':message type:->message-types' \ + ':parameter:->parameters' && ret=0 + + case $state in + message-types) + msgs=( ${${${${${(f)"$(_call_program message-types smbcontrol -\? 2>&1)"}[(r)