git: ef64775074c3 - main - shells/zsh: add completion for mdo(1)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 Jan 2025 08:01:28 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/ports/commit/?id=ef64775074c37030deb876254221e5c1286d4e3d
commit ef64775074c37030deb876254221e5c1286d4e3d
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2025-01-10 08:01:05 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2025-01-10 08:01:26 +0000
shells/zsh: add completion for mdo(1)
---
shells/zsh/Makefile | 4 +++-
shells/zsh/files/_mdo | 18 ++++++++++++++++++
shells/zsh/pkg-plist | 1 +
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/shells/zsh/Makefile b/shells/zsh/Makefile
index c4dabc1fced6..d3e7f5711c9f 100644
--- a/shells/zsh/Makefile
+++ b/shells/zsh/Makefile
@@ -1,6 +1,6 @@
PORTNAME= zsh
DISTVERSION= 5.9
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= shells
MASTER_SITES= https://www.zsh.org/pub/ \
SF \
@@ -107,6 +107,8 @@ post-build:
${WRKSRC}/Doc/zshall.1)
post-install:
+ ${INSTALL_DATA} ${FILESDIR}/_mdo \
+ ${STAGEDIR}/${DATADIR}/${ZSH_VER}/functions/Completion/Unix/
${MKDIR} ${STAGEDIR}${DATADIR}/site-functions
${LN} -f ${STAGEDIR}${PREFIX}/bin/zsh ${STAGEDIR}${PREFIX}/bin/rzsh
# Precompile completions and functions
diff --git a/shells/zsh/files/_mdo b/shells/zsh/files/_mdo
new file mode 100644
index 000000000000..32d1c83aab3a
--- /dev/null
+++ b/shells/zsh/files/_mdo
@@ -0,0 +1,18 @@
+#compdef mdo
+
+local environ e cmd cpp
+local -a _comp_priv_prefix
+local -A opt_args
+
+zstyle -a ":completion:${curcontext}:" environ environ
+
+for e in "${environ[@]}"
+do local -x "$e"
+done
+
+cmd="$words[1]"
+cpp='_comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)-u]} )'
+_arguments -s -S -A '-*' : \
+ '-u+[run command as specified user]: :_users' \
+ '-i[keep the calling user]' \
+ "*:: :{ $cpp; _normal }"
diff --git a/shells/zsh/pkg-plist b/shells/zsh/pkg-plist
index 63145be027e1..145b93d13925 100644
--- a/shells/zsh/pkg-plist
+++ b/shells/zsh/pkg-plist
@@ -627,6 +627,7 @@ bin/zsh-%%ZSH_VER%%
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_make
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_man
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_md5sum
+%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_mdo
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_mencal
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_mh
%%DATADIR%%/%%ZSH_VER%%/functions/Completion/Unix/_mime_types