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

Re: [patch] Completions for cu, fw_update, and rcctl



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



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