summaryrefslogtreecommitdiffstats
path: root/Completion
diff options
context:
space:
mode:
authordana <dana@dana.is>2026-07-08 15:45:30 -0500
committerdana <dana@dana.is>2026-07-08 15:45:33 -0500
commit9b94d374bb787342ab8143f17c7ffa0e324c6255 (patch)
tree6df7cabd2e4a8fbbbb4a5cd4f6dc34e814259e72 /Completion
parent54913: _numbers: pass -r and -R to compadd (diff)
downloadzsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar.gz
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar.bz2
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar.lz
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar.xz
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.tar.zst
zsh-9b94d374bb787342ab8143f17c7ffa0e324c6255.zip
54913: _message: improve option parsing
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/Core/_message26
1 files changed, 14 insertions, 12 deletions
diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message
index b80aa4237..8c3f351f6 100644
--- a/Completion/Base/Core/_message
+++ b/Completion/Base/Core/_message
@@ -1,19 +1,26 @@
#autoload
-local format raw gopt
+local format raw
+local -a gopt
+local -A opth
-if [[ "$1" = -e ]]; then
+zparseopts -A opth -D -F - \
+ {1+,2+,V+:,J+:}=gopt F: M: n o: q s: S: x: X: \
+ e r \
+|| return
+
+if (( $+opth[-e] )); then
local expl ret=1 tag
_comp_mesg=yes
- if (( $# > 2 )); then
- tag="$2"
+ if (( $# > 1 )); then
+ tag=$1
shift
else
tag="$curtag"
fi
- _tags "$tag" && while _next_label "$tag" expl "$2"; do
+ _tags "$tag" && while _next_label "$tag" expl "$1"; do
compadd ${expl:/-X/-x}
ret=0
done
@@ -24,15 +31,10 @@ if [[ "$1" = -e ]]; then
return ret
fi
-gopt=()
-zparseopts -D -a gopt 1 2 V J
-
_tags messages || return 1
-if [[ "$1" = -r ]]; then
- raw=yes
- shift
- format="$1"
+if (( $+opth[-r] )); then
+ raw=yes format=$1
else
zstyle -s ":completion:${curcontext}:messages" format format ||
zstyle -s ":completion:${curcontext}:descriptions" format format