zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: doas completion
Date: Fri, 30 Sep 2016 09:06:30 +0200	[thread overview]
Message-ID: <80164.1475219190@hydra.kiddle.eu> (raw)

Much of this is just cut and paste from _sudo.
I think the -a option might be OpenBSD specific: once things settle down
with a single portable doas implementation instead of the current state
of there being several then that can be cleaned up.

Oliver

diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas
new file mode 100644
index 0000000..5c26b1d
--- /dev/null
+++ b/Completion/Unix/Command/_doas
@@ -0,0 +1,18 @@
+#compdef doas
+
+local environ e cmd
+
+zstyle -a ":completion:${curcontext}:" environ environ
+
+for e in "${environ[@]}"
+do local -x "$e"
+done
+
+cmd="$words[1]"
+_arguments -s -S \
+  '(-n -s)-C+[check config file and report on command matching]:config:_files' \
+  '(-C)-n[non-interactive: fail rather than prompt for a password]' \
+  '-a+[specify authentication style]:authentication style' \
+  '(-C)-s[run a shell]' \
+  '-u+[run command as specified user]:user:_users' \
+  '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }'


             reply	other threads:[~2016-09-30  7:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30  7:06 Oliver Kiddle [this message]
2016-10-01 14:31 ` Matthew Martin
2016-10-01 14:34   ` Matthew Martin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80164.1475219190@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).