From c9cb5bdf841fdaf6817b95be5e91141221b3bec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Mon, 4 May 2020 20:22:49 +0000 Subject: [PATCH] Add completion for yash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- README.md | 4 ++-- argz/{argz.sh => comp/argz.bash} | 0 argz/comp/argz.yash | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) rename argz/{argz.sh => comp/argz.bash} (100%) create mode 100644 argz/comp/argz.yash diff --git a/README.md b/README.md index 65314a4..23f0b02 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ Then, run as `root`: As usual, you can customize the destination with `DESTDIR` and `prefix`. If you want the tab completion in `bash`, you have to do it manually for now. -Luckily, it's super easy! Just download the file [argz.sh](argz/argz.sh) and then: +Luckily, it's super easy! Just download the file [argz.bash](argz/comp/argz.bash) and then: - $ . argz.sh + $ . argz.bash $ complete -F _argz secret It's exactly the same for `zsh` if you have enabled `bashcompinit'. diff --git a/argz/argz.sh b/argz/comp/argz.bash similarity index 100% rename from argz/argz.sh rename to argz/comp/argz.bash diff --git a/argz/comp/argz.yash b/argz/comp/argz.yash new file mode 100644 index 0000000..9bd97e5 --- /dev/null +++ b/argz/comp/argz.yash @@ -0,0 +1,11 @@ +function completion/argz { + typeset opts + opts="$($WORDS help 2>/dev/null | awk '{print $1}')" + case "$opts" in + '') ;; + CMD) complete -c;; + DIR) complete -d;; + FILE) complete -f;; + *) complete -- $opts + esac +}