pacak / bpaf

Command line parser with applicative interface
336 stars 17 forks source link

Autocomplete goodies #337

Open pacak opened 7 months ago

pacak commented 7 months ago
ysndr commented 1 week ago

Hej,

Is this likely to fix issues like we see here [1]? I.e. parsing errors "leaking" out of the completer and blocking you from doing anything except ^C and start over again?

Note in this particular case we have a -f and a -d <arg> flag both being short aliases. I understand that -fd is not a correct argument, but in this case i'd expect arguments to -d to be completed here instead. suggesto -f=d in this case is just incorrect i'd say.

[1] https://github.com/flox/flox/issues/1657

Edit: It does seem to ignore these errors now, so that's a start, but this is apparently still in progress considering the debug output it produces.

pacak commented 1 week ago

I understand that -fd is not a correct argument, but in this case i'd expect arguments to -d to be completed here instead.

Even if I could start completing arguments for -d here - it won't work once you press enter and try to run the whole thing. The goal is to either move to completing the next item -fd<TAB> -> -fd _ or to break them down into separate items: -fd<TAB> -> -f -d _.

zsh with its default completion scripts support doing something smart with adjacent single letter flags, bash does not.

So yeah, I'm planning to fix this problem, but I'm not sure yet what the best solution is. Dealing with a newborn is not helping :)

ysndr commented 1 week ago

Well, congratulations :)

I'm fine with it not completing if the result wouldn't be valid anyway.. Mainly hoping to get this to work without it messing up the terminal at least ^^

Is this PR the right place to start if i were to look at it myself?

pacak commented 1 week ago

Well, congratulations :)

:heart:

Mainly hoping to get this to work without it messing up the terminal at least ^^

Should be here, but it's a mess... Might be easier to try to address that issue directly, gimme a sec.