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,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1462193720; bh=8xolCZdiVQMracJU6gMkha8KEYDUGfH/douaTDN8L9w=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=SRAv9a/8aC+7AC5+tDSS58AwrDD5/RjjRD1TIpfsmPX9ZmFaahMHAXC/5RfefDxT7IbgTW/CxwL0Q/l8SIWqaIqK1E/fftf9iCVzokKI0suRaly2vRhI68VrEL/zssFkT9wMbjjKBBl5h83xmYcUqPbDU+jcJcSWVUZoarRVPQv1sGWLL9BJ9C6BGI8SY22hmVTS1DpxN+09L5lv4Q3idoR6TQCgebU8CqrFeCkoZpW2lMKNgdfgVEVIiRyCNhZ0IHVanStIL2QzWLI2ChIwBrGESqKdxXE1o9KPvyi0T60AonyXrUfPHjX9uFFC3GWedNfCItO90FDk2A/j0k0GJA==
X-Yahoo-Newman-Id: 698156.36990.bm@smtp127.mail.ir2.yahoo.com
X-Yahoo-Newman-Property: ymail-3
X-YMail-OSG: vZXUL9QVM1mbqotE7AfOo_gUfwkTGT5CbFff6wBdO5SSBdH
 8fS1RWkz1kXJFk9wi6Okdo9tBAa64ScTmp67vr.j8qoUR7MdompyISvkfnj.
 TTG9Mj8OyX3YlaSZ0eZSAJYVEaszD9xpn0.nVrj66Cqfixwc6u4dU9ZM5gHq
 1687hLGCiumy9ImPOh1q3O7Fbx3jqoZEG5e8S9YiythdId2oNFgqarovJegk
 qk484nIdgAh14qcTImTTrQWlYoGOu_kJEW0xrYI6MS7FXWBUx2kg27XX.TL0
 CSVowdzrzqnz672SuhRUN2BQyWYoj5RNya5bOUYznFg5rv.PaP_ktsv1bn9W
 EPXXVuQ6pUext5hS3kbMOCXQu5nVzd1L2Z5qiDv.G817TptGhK9nntlf6DkP
 WAb16ezTCDSQP7S2s0EbAiEJ8GrQV5JvUlUr4NL5TQqAjmQU_di94DdJ7i0O
 fmlNHb8cw8ZhH.w.nMSO4qtGtQGxsjTKklyMsMi5plVajHaQj8R4kTpgsDmJ
 gNuS8xr9gW6nGklPot0LPz4jQfJ4p
X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI-
In-reply-to: <1462109252-12482-1-git-send-email-ft@bewatermyfriend.org>
From: Oliver Kiddle <okiddle@yahoo.co.uk>
References: <87k2jegi5h.fsf@ft.bewatermyfriend.org> <1462109252-12482-1-git-send-email-ft@bewatermyfriend.org>
To: zsh-workers@zsh.org
Subject: Re: [PATCHv3] Refactor baud rate completion
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-ID: <27857.1462193719.1@thecus.kiddle.eu>
Date: Mon, 02 May 2016 14:55:19 +0200
Message-ID: <27858.1462193719@thecus.kiddle.eu>
X-Seq: zsh-workers 38390

Frank Terbeck wrote:
> This adds a new helper function _baudrate and uses it in place of
> private solutions in various existing completions.

Some comments on this: the normal convention is for helper functions
to have plural names. The logic being that all baud rates are added
as matches. So this should be named _baudrates or _baud_rates.

Secondly, the convention for completion functions is two spaces for
indentation. See Etc/completion-style-guide. Annoyingly, there's quite a
few functions that don't follow this but it'd be nice if we could avoid
adding more.

> +#     -t TAG       Use TAG as the tag value in _wanted call.
> +#
> +#     -d DESC      Use DESC as the description value in _wanted call.

It is usually more flexible to just accept normal compadd options for
descriptions and tags and pass them on to compadd fairly directly. It
then will work in conjunction with other helpers like _alternative.
_pdf is a good example. Using _wanted here isn't entirely necessary:
_description would be sufficient and avoids nesting tag loops.

> +# It is also possible to override the arguments to -f, -u and -l via styles in
> +# a similar fashion:
> +#
> +#   zstyle ':completion:*:*:screen:*' max-baud-rate 9600
> +#   zstyle ':completion:*:*:screen:*' min-baud-rate 1200
> +#   zstyle ':completion:*:*:screen:*' baud-filter some_function_name

The original concept with styles was that style's could have fairly
generic names because the context allows you to select the detailed
context. So perhaps consider allowing this to work as, for example:
  zstyle ':completion:*:*:screen:*:baud-rates' max-value 9600

Oliver

