Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham
	autolearn_force=no version=3.4.1
From: Frank Terbeck <ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Cc: Oliver Kiddle <okiddle@yahoo.co.uk>
Subject: [PATCH 4/6] _baudrates: Fit better into the general completion framework
Date: Sun,  8 May 2016 00:09:14 +0200
Message-Id: <1462658956-11785-5-git-send-email-ft@bewatermyfriend.org>
X-Mailer: git-send-email 2.8.1
In-Reply-To: <1462658956-11785-1-git-send-email-ft@bewatermyfriend.org>
References: <27858.1462193719@thecus.kiddle.eu>
 <1462658956-11785-1-git-send-email-ft@bewatermyfriend.org>
X-Df-Sender: NDMwNDQ0
X-Seq: zsh-workers 38421

This should work better in concert with other helpers and builtins of
the completion system by accepting arguments that would be handed to
compadd.
---
 Completion/Unix/Type/_baudrates | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/Completion/Unix/Type/_baudrates b/Completion/Unix/Type/_baudrates
index c6425f0..c1ee3f4 100644
--- a/Completion/Unix/Type/_baudrates
+++ b/Completion/Unix/Type/_baudrates
@@ -15,10 +15,6 @@
 #                  value in the complete list to generate an arbitrary
 #                  sub-set.
 #
-#     -t TAG       Use TAG as the tag value in _wanted call.
-#
-#     -d DESC      Use DESC as the description value in _wanted call.
-#
 # The default complete list of available baud rates is also configurable via
 # the 'baud-rates' style:
 #
@@ -31,11 +27,11 @@
 #   zstyle ':completion:*:*:screen:*' min-baud-rate 1200
 #   zstyle ':completion:*:*:screen:*' baud-rate-filter some_function_name
 
+local tmp
+local -a expl rates
 local -A opts
-local expl tag desc tmp
-local -a rates
 
-zparseopts -E -A opts u: l: f: d: t:
+zparseopts -E -A opts u: l: f:
 
 # The following uses a generated list; first find out where the B* macros are
 # defined:
@@ -76,9 +72,7 @@ if (( ${+opts[-f]} )); then
   done
 fi
 
-tag=${opts[-t]:-baud-rate}
-desc=${opts[-d]:-baud rate}
-
 # -1V removes dupes (which there shouldn't be) and otherwise leaves the
 # order in the $rates array intact.
-_wanted -1V $tag expl $desc compadd -a $expl -- rates
+_description -1V baud-rates expl 'baud rate'
+compadd "${(@)argv/#-J/-V}" "$expl[@]" -- "${rates[@]}"
-- 
2.8.1

