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

Re: How to write completion function for arguments like unix:/path/to/socket



On 1/28/24, Celeste Liu <coelacanthushex@xxxxxxxxx> wrote:
> Hi,
>
> Recently I write zsh completion file for a serial port tool named tio. It
> has
> a feature to redirect I/O to a socket, so there is a argument --socket which
>
> accepts something like unix:/path/to/socket or inet:1234. But I don't know
> how
> to write this function. Could someone help me? Thanks.

You probably want to use something like
if compset -P unix:; then
  _files -g '*(=)'
elif compset -P inet:; then
  ...?...
fi

-- 
Mikael Magnusson




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