Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[PATCH] Completion batch #2: Misc. trivial fixes



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'




Messages sorted by: Reverse Date, Date, Thread, Author