Zsh Mailing List Archive
Messages sorted by:
Re: [PATCHv3] Refactor baud rate completion
- X-seq: zsh-workers 38390
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCHv3] Refactor baud rate completion
- Date: Mon, 02 May 2016 14:55:19 +0200
- 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==
- In-reply-to: <email@example.com>
- List-help: <mailto:firstname.lastname@example.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:email@example.com>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <firstname.lastname@example.org> <email@example.com>
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
> +# -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
Messages sorted by: