aboutsummaryrefslogtreecommitdiff
path: root/extra/yash/files
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-05-04 22:45:14 +0300
committerCem Keylan <cem@ckyln.com>2021-05-04 22:45:14 +0300
commit4585a016fb5c287f8bb58efcfb7dc05439de5819 (patch)
tree84921e8d291c1c3d883d925e01635c4e47690dec /extra/yash/files
parent196c7ef6f49601e7a0fb68d70a8cfba801baea29 (diff)
downloadrepository-4585a016fb5c287f8bb58efcfb7dc05439de5819.tar.gz
yash: completion changes
Diffstat (limited to 'extra/yash/files')
-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
+
+}