aboutsummaryrefslogtreecommitdiff
path: root/extra/yash/files/doas
diff options
context:
space:
mode:
Diffstat (limited to 'extra/yash/files/doas')
-rw-r--r--extra/yash/files/doas42
1 files changed, 42 insertions, 0 deletions
diff --git a/extra/yash/files/doas b/extra/yash/files/doas
new file mode 100644
index 00000000..ffe41bbc
--- /dev/null
+++ b/extra/yash/files/doas
@@ -0,0 +1,42 @@
+# Completion script for the "doas" command.
+function completion/doas {
+
+ typeset OPTIONS ARGOPT PREFIX
+ OPTIONS=( #>#
+ "C:; specify the config file to parse and check its contents"
+ "L; Clear any persisted authorizations from previous invocations"
+ "n; Non interactive mode, fail if doas would prompt for password"
+ "s; run \$SHELL"
+ "u:; specify the user to change to"
+ ) #<#
+
+ command -f completion//parseoptions
+ case $ARGOPT in
+ (-)
+ command -f completion//completeoptions
+ ;;
+ (C)
+ complete -P "$PREFIX" -f
+ ;;
+ (u)
+ complete -P "$PREFIX" -u
+ ;;
+ ('')
+ typeset i=2 edit=false
+ while [ $i -le ${WORDS[#]} ]; do
+ case ${WORDS[i]} in
+ (--) break;;
+ (-e) edit=true;;
+ esac
+ i=$((i+1))
+ done
+ if $edit; then
+ complete -P "$PREFIX" -f
+ else
+ command -f completion//getoperands
+ command -f completion//reexecute
+ fi
+ ;;
+ esac
+
+}