zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] Completion batch #2: Misc. trivial fixes
@ 2018-01-03 21:29 dana
  2018-01-03 23:40 ` Oliver Kiddle
  0 siblings, 1 reply; 6+ messages in thread
From: dana @ 2018-01-03 21:29 UTC (permalink / raw)
  To: zsh-workers

Some trivial/miscellaneous changes to existing functions:

1. I fixed a bug in `tr` completion — it wasn't showing the option descriptions
   for non-GNU variants.

2. I updated `expand` and `unexpand` completion to account for numeric options
   as in `expand -4` (instead of `expand -t4`); most variants support this. I
   excluded BusyBox, even though the function doesn't currently make any effort
   to check for it, because i plan to gradually add support for BusyBox variants
   when it's not too irritating (will show up in later batches).

The changes after this one will be more complex.

dana


diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr
index d244bf875..1cfe1200a 100644
--- a/Completion/Unix/Command/_tr
+++ b/Completion/Unix/Command/_tr
@@ -28,7 +28,7 @@ case $variant in
   ;|
   *)
     for k in c d s; do
-      args+=( -$k$descr[$k] )
+      args+=( -$k$descr[-$k] )
     done
   ;;
 esac
diff --git a/Completion/Unix/Command/_unexpand b/Completion/Unix/Command/_unexpand
index 13f6ce835..b548b3c3a 100644
--- a/Completion/Unix/Command/_unexpand
+++ b/Completion/Unix/Command/_unexpand
@@ -28,6 +28,10 @@ elif [[ $OSTYPE = (*bsd*|dragonfly*|darwin*) ]]; then
 fi
 [[ $service = *un* ]] && args+=(  "(--all --help --version)-a[$all]" )
 
+# Most (un)expand variants, excluding BusyBox, allow e.g. -4 instead of -t4
+[[ $_cmd_variant[$service] == *busybox* ]] ||
+args+=( '!(-0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -t --tabs)-'{0..9} )
+
 _arguments -s -S "$args[@]" \
   "(--tabs --help)-t+${tabs}" \
   '*:file:_files'



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-06  6:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-03 21:29 [PATCH] Completion batch #2: Misc. trivial fixes dana
2018-01-03 23:40 ` Oliver Kiddle
2018-01-04  0:03   ` dana
2018-01-04 11:47     ` Oliver Kiddle
2018-01-04 16:05       ` dana
2018-01-06  6:11         ` dana

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).