* How to write completion function for arguments like unix:/path/to/socket
@ 2024-01-28 12:25 Celeste Liu
2024-01-28 14:10 ` Mikael Magnusson
0 siblings, 1 reply; 3+ messages in thread
From: Celeste Liu @ 2024-01-28 12:25 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1.1.1: Type: text/plain, Size: 330 bytes --]
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.
Best regards
Celeste Liu
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 12137 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to write completion function for arguments like unix:/path/to/socket
2024-01-28 12:25 How to write completion function for arguments like unix:/path/to/socket Celeste Liu
@ 2024-01-28 14:10 ` Mikael Magnusson
2024-01-28 14:22 ` Celeste Liu
0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2024-01-28 14:10 UTC (permalink / raw)
To: Celeste Liu; +Cc: zsh-users
On 1/28/24, Celeste Liu <coelacanthushex@gmail.com> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to write completion function for arguments like unix:/path/to/socket
2024-01-28 14:10 ` Mikael Magnusson
@ 2024-01-28 14:22 ` Celeste Liu
0 siblings, 0 replies; 3+ messages in thread
From: Celeste Liu @ 2024-01-28 14:22 UTC (permalink / raw)
To: Mikael Magnusson; +Cc: zsh-users
[-- Attachment #1.1.1: Type: text/plain, Size: 632 bytes --]
On 2024-01-28 22:10, Mikael Magnusson wrote:
> On 1/28/24, Celeste Liu <coelacanthushex@gmail.com> 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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 12933 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-28 14:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-28 12:25 How to write completion function for arguments like unix:/path/to/socket Celeste Liu
2024-01-28 14:10 ` Mikael Magnusson
2024-01-28 14:22 ` Celeste Liu
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).