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.0 (2014-02-07) 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.0
Date: Sun, 10 Jan 2016 19:53:22 +0000
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: Matthew Martin <phy1729@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: [patch] Completions for cu, fw_update, and rcctl
Message-ID: <20160110195322.GD11464@tarsus.local2>
References: <20160110075141.GA15837@CptOrmolo.darkstar>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20160110075141.GA15837@CptOrmolo.darkstar>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Seq: zsh-workers 37550

Matthew Martin wrote on Sun, Jan 10, 2016 at 01:51:41 -0600:
> Few completers for OpenBSD utilities that have been sitting in my tree.
> 
> Not sure if listing line speeds is overkill (fine by me to remove them
> if anyone thinks it is).

I think it's a nice touch.  When I work with cu the last thing I want is
to have to remember whether the magic number is 115200 or 112500 ☺

> diff --git a/Completion/BSD/Command/_cu b/Completion/BSD/Command/_cu
> new file mode 100644
> index 0000000..d4658e3
> --- /dev/null
> +++ b/Completion/BSD/Command/_cu
> @@ -0,0 +1,7 @@
> +#compdef cu
> +
> +_arguments -s -A '-*' \
> +  '-d[do not block waiting for a carrier to be detected]' \
> +  '-l[line to use]:line:(/dev/cuaU#<->(%))' \

I'm surprised a glob pattern works inside the parentheses.  I'd have
expected a call to _files would be needed.

On Linux the device is called /dev/ttyS0, so the pattern could be:
    /dev/(cuaU#<->|ttyS<->)(N%c)
? [with (N) to support other OSes]

Maybe encapsulate this as Completion/Unix/Type/_tty_lines so screen(1)
and friends can reuse it in the future?

> +  '-s[line speed]:line speed:(75 110 300 1200 2400 4800 9600 19200 38400 57600 115200)' \
> +  '(-*)1:host:'

Haven't looked at the rest.

Daniel

