shells/zsh: add completion for mdo(1)

This commit is contained in:
Baptiste Daroussin 2025-01-10 09:01:05 +01:00
parent 357a3a9d08
commit ef64775074
3 changed files with 22 additions and 1 deletions

View file

@ -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

18
shells/zsh/files/_mdo Normal file
View file

@ -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 }"

View file

@ -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