carapace-sh / carapace-bin

multi-shell multi-command argument completer
https://carapace.sh
MIT License
885 stars 48 forks source link

tldr: Error in quoting command names #2342

Closed aftix closed 6 months ago

aftix commented 6 months ago

Current Behavior

I'm using tealdeer, a tldr client. Carapace uses tldr -l to get a list of commands in the tldr documentation database, but the command returns names that need to be quoted such as ! and [. As a result, tab completion on tldr gives an error instead of providing completions.

Expected Behavior

carapace should correctly quote these command names so that tab completion works as expected.

Steps To Reproduce

  1. Build carapace from master
  2. Install tealdeer
  3. Run carapace tldr bash ''
  4. carapace returns trueERR\n-

I have tried with every available shell, and they all return their own flavor of "ERR".

EDIT: I have tried with tlrc(the official tldr client) and the same thing happens

Version

master

OS

Shell

Anything else?

No response

rsteube commented 6 months ago

Urks. So the issue here is that there are multiple clients that all use the binary name tldr :roll_eyes: and have different behaviour. The current completer was written for the python version which is installed by the tldr package in arch/manjaro.

aftix commented 6 months ago

I spun up a venv and saw the python tldr has a much different output than the others. Could there be completers for say tealdeer and tlrc and have it be up to the user to set the right completion command in their rc file?

rsteube commented 6 months ago

Yes. I've been meaning to put together a concept for this for a while now as some core tools differ between distros. It's pretty simple though. Just deciding where to put it and updating some code here and there.

User specs override internal completers so that could be used as workaround in the meantime.

aftix commented 6 months ago

Are you open to a PR adding completers/tealdeer_completer for now?

rsteube commented 6 months ago

Yeah, can do that. Got one here: https://github.com/carapace-sh/carapace-bin/pull/2345/files Just copy it to tealdeer_completer and the action for a new pr.