From 4585a016fb5c287f8bb58efcfb7dc05439de5819 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Tue, 4 May 2021 22:45:14 +0300 Subject: yash: completion changes --- extra/yash/build | 2 ++ extra/yash/checksums | 2 ++ extra/yash/files/doas | 42 ++++++++++++++++++++++++++++++ extra/yash/patches/neatvi-completion.patch | 15 +++++++++++ extra/yash/sources | 2 ++ 5 files changed, 63 insertions(+) create mode 100644 extra/yash/files/doas create mode 100644 extra/yash/patches/neatvi-completion.patch (limited to 'extra/yash') diff --git a/extra/yash/build b/extra/yash/build index b70f863b..d01449fa 100755 --- a/extra/yash/build +++ b/extra/yash/build @@ -2,6 +2,8 @@ export LDFLAGS="$LDFLAGS -static" +patch -p1 < neatvi-completion.patch + ./configure \ --prefix=/usr \ --enable-help \ diff --git a/extra/yash/checksums b/extra/yash/checksums index 29675a7e..e1c275b9 100644 --- a/extra/yash/checksums +++ b/extra/yash/checksums @@ -1 +1,3 @@ 6f15e68eeb63fd42e91c3ce75eccf325f2c938fa1dc248e7213af37c043aeaf8 yash-2.51.tar.xz +318d93c763e560bb2201e06eb2d9c290d0996b962463ef06965a4002d860abdc doas +32f8e38ce72d179e207bda071f0a4fd4986cc770ccdb0da7b3b33d903cda403e neatvi-completion.patch 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 + +} diff --git a/extra/yash/patches/neatvi-completion.patch b/extra/yash/patches/neatvi-completion.patch new file mode 100644 index 00000000..795fd6b6 --- /dev/null +++ b/extra/yash/patches/neatvi-completion.patch @@ -0,0 +1,15 @@ +Neatvi doesn't support parsing flags and it will open the editor immediately, +so we don't actually want this check performed. +--- yash-orig/share/completion/ex 2020-12-10 16:40:05.000000000 +0300 ++++ yash/share/completion/ex 2021-05-04 22:12:17.299050403 +0300 +@@ -6,10 +6,6 @@ + + function completion/ex { + +- case $("${WORDS[1]}" --version 2>/dev/null) in (VIM*) +- command -f completion//reexecute vim +- return +- esac + typeset type="$(uname 2>/dev/null)" + + typeset OPTIONS POSIXOPTIONS ADDOPTIONS ARGOPT PREFIX diff --git a/extra/yash/sources b/extra/yash/sources index 8da8cf85..d3a9279a 100644 --- a/extra/yash/sources +++ b/extra/yash/sources @@ -1 +1,3 @@ https://github.com/magicant/yash/releases/download/2.51/yash-2.51.tar.xz +files/doas share/completion +patches/neatvi-completion.patch -- cgit v1.2.3