Closed kpbaks closed 1 month ago
Hi! Glad you're making use of it!
I am able to complete the first <FS>
(complgen version
gives v0.2.0-15-g1d555d2ec7
):
But it won't work for the subsequent <FS>
s because you're hitting one of the caveats:
Within subwords,
{{{ ... }}}
is only allowed at tail position, where it doesn't lead to matching against an arbitrary output of an external command:
ERROR:
{{{ git tag }}}..{{{ git tag }}}
Impossible to guess at compilation time where the output of the first
{{{ git tag }}
ends and our..
begins.OK:
--option={{{ echo foo }}}
ERROR:
{{{ echo foo }}}{{{ echo bar }}}
Impossible to guess at compilation time where the output of the first
{{{ echo foo }}
ends the second{{{ echo bar }}}
begins.
Basically, complgen cannot tell where the output of {{{ string split ' ' --fields 3 </proc/mounts | sort --unique }}}
ends and the ,
begins — the output might as well have contained a comma and then it would be ambiguous.
Now, you should be getting a compilation error from complgen for this specific case but apparently it didn't work — I will fix that.
It's not possible to cover this pattern if the completions come from an external source currently. For it to do what you want, the splitting on commas would have to happen inside of {{{ string split ' ' --fields 3 </proc/mounts | sort --unique }}}
.
Thank you for the elaborate reply. I forgot to mention the version of complgen
I use. I think it is v0.1.8 based on the version packages in nixpkgs unstable right now.
Wow, I didn't realize someone wrote a nixpkg for it. I will check it out.
Tightened error reporting and sketched out a new feature that should cover this case. Thanks for reporting!
First of all. Thank you for creating this tool, it really makes it simple to write completion scripts!
I am trying to write a completion for duf. Several of its flags support giving multiple values separated with comma e.g:
So far I got it working with a single value with the
<FS>
nonterminal. But when i specify the alternative-hide-fs <FS>[,<FS>]...
and press tab i get all of them at once with no comma separation:Is it possible to express this pattern, and if so what is the correct syntax for it?
System
I use
fish
version3.7.1
Here is my
duf.usage
file: