From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26822 invoked by alias); 13 Dec 2014 18:52:53 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 33958 Received: (qmail 27172 invoked from network); 13 Dec 2014 18:52:49 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1418496365; bh=mv7YC14xGjDJkaDAdOKiGyQ35xggUWzsiOAfF3B4K+4=; h=From:To:Subject:Date:From:Subject; b=hjGPNIfmqub760hnoSBpaDXSt2fKyWdEmFTqWlnSVPmXcOAWg1M51TMsfRRtw92Dhj146gWvKLbQQE3ZfM+zPbT91wnaxYqrkzNxGz0NUEIC30rejY0gCuaUWg5t8qGp1ZvscuyM7EoM5Cmc7jyTgtpq12k2z3ZKmW4Li0LmSFnahKIJW+pXsyoHQVg+SoTMhrELG434AGY6soUOwFHA0/8tt4/Cs4zgbMZZ3L8Z2iZbmurATglILTIfIWapZvC34U4ocQbaDHPKpSV578Yu8BwKK8AwgwsX9HUz+U1yzi6VkulSVTqISmTCKvB7SzEb7l+BwbQbteJW15FW+1ZY8A== DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=FRtQOemz0yNa9BRfO0uHCEjekqBShln9URDvmZWESooKiIJ3ufyfuKJLqsakKIxMJPmbZq7jWjv5LBpqjowmp+94uKL7A4vnBh6ZdxxAQjXGPyC5bm1U3FWhHp9iGO57GfIiDayAGrZ6xoPDLVoIzg+nm9r81Xt2ZFyQpxcC6y1oDA4rlqgD1euGgG/iwNbyco6qYQnH0Mdb0MFoqlsq4GzoBmN9kAKBsyJ6tmh6UGNh81+8RvBloUOuXT4+4KRXda2PRV+cYXw7/PsdWnLnPZ5ZUXOJJgATVHgM+nil2bJaO0Sl7FbdATbYIYKXbCWcWVou4d2zMTtEe5oQG/xE7g==; X-Yahoo-Newman-Id: 361550.48183.bm@smtp145.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: Jp2TNKcVM1l5nstkH6shy.Ub17fElJKUWuyNiP9Vp.jbZKV TucKIHnBCVFeRG8W6G3y6Wg30r7JIRNGvMRmq3t4K61JmrnE.J8ELdNO7udv EsICvjNGq_b2qhWzOJk_YvoxDKZH2B3RJP38t5ENZcld4T5zgnAvZDc5gzD7 h4UmTbnCHOJCDji_6FRbgTTru3XD9p_5U60hIQmastUQRw4r1_9J.BV7WjXm 4OkvX60FbOx6_QFJXYdURcO7COldzpus0uv4lXkOf1M5xgRa1EHlVDZiKmgR h_dPzuleZd6L0lvPB_nagVbklRLjDmToOAhRu4MKEPcwWPeMIxUdV1JSI5xv kvPqeN162d1oVerkWCWD.UzlbUuwbHfrarVOp2BSyqCnYk5d_yP8GjNNuWZg KctwabLa_QEvkrgv62U0I0YOfT7qXVLpIQoRSvZzTK_ZNKBFpvgAUXsj8y2j K5sL15Wgz84foRhaXDBwhV7tJbdnYN9GCphR29J3MiYKZElV8oCZ_mJW54be zLe0r_.NIDHRbC6.p7Pe4bY6q_NQ- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- From: Oliver Kiddle To: Zsh workers Subject: PATCH: updated sudo completion MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11939.1418496363.1@thecus.kiddle.eu> Date: Sat, 13 Dec 2014 19:46:04 +0100 Message-ID: <11940.1418496364@thecus.kiddle.eu> This updates the sudo completion. Oliver diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index f8543f8..ee238b4 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -1,6 +1,6 @@ #compdef sudo sudoedit -local curcontext="$curcontext" environ e +local environ e local -a args zstyle -a ":completion:${curcontext}:" environ environ @@ -10,33 +10,39 @@ do local -x "$e" done args=( - '-V[show version]' - '-l[list allowed commands]' - '-L[list options from Default section]' - '-a[BSD auth type]:BSD auth type:' - '-c[BSD login class]:BSD login class:' - '-h[show help]' - '-v[validate user timestamp]' - '-k[invalidate user timestamp]' - '-K[remove user timestamp]' - '-r[Kerberos realm]:Kerberos realm:' - '-p[password prompt]:password prompt:' - '-u[user name]:user name:_users' - '-S[read password from stdin]' + '(-A --askpass)'{-A,--askpass}'[use a helper program for password prompting]' + '(-C --close-from)'{-C+,--close-from=}'[close file descriptors]:lowest fd to close' + '(-g --group)'{-g+,--group=}'[run command as the specified group name or ID]:group:_groups' + '(-)'{-h,--help}'[display help message and exit]' + '(-h --host)'{-h+,--host=}'[run command on host]:host:_hosts' + '(-K --remove-timestamp)'{-K,--remove-timestamp}'[remove timestamp file completely]' + '(-k --reset-timestamp)'{-k,--reset-timestamp}'[invalidate timestamp file]' + \*{-l,--list}"[list user's privileges or check a specific command]" + '(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]' + '(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt' + '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]:role' + '(-S --stdin)'{-S,--stdin}'[read password from standard input]' + '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]:type' + '(-U --other-user)'{-U+,--other-user=}'[in list mode, display privileges for user]:user:_users' + '(-u --user)'{-u+,--user=}'[run command (or edit file) as specified user]:user:_users' + '(-)'{-V,--version}'[display version information and exit]' + '(-v --validate)'{-v,--validate}"[update user's timestamp without running a command]" ) -if [[ $service = sudoedit ]]; then - _arguments $args \ - '*:file: _files' +if [[ $service = sudoedit || -n ${words[(r)-e]} ]]; then + args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' ) else - _arguments $args \ - '(- :)-e[edit file]:*:file:_files' \ - '(- :)-s[run SHELL]' \ - '(- :)-i[simulate login]' \ - '(-i -s -e)-b[run command in background]' \ - '(-i -s -e)-E[preserve environment]' \ - '(-i -s -e)-H[set HOME environment variable]' \ - '(-i -s -e)-P[preserve group vector]' \ - '(-):command: _command_names -e' \ + args+=( + '(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \ + '(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \ + '(-i --login)'{-i,--login}'[run login shell as the target user; a command may also be specified]' \ + '(-b --background -i --login -s --shell -e --edit)'{-b,--background}'[run command in the background]' \ + '(-E --preserve-env -i --login -s --shell -e --edit)'{-E,--preserve-env}'[preserve user environment when running command]' \ + '(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \ + '(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \ + '(-)1:command: _command_names -e' '*::arguments: _normal' + ) fi + +_arguments -s -S $args