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 2024-01-28 22:10, Mikael Magnusson wrote:

> 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
> 

It works. Thank you!

73
Celeste Liu

Attachment: OpenPGP_0x15F4180E73787863.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature



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