carapace-sh / carapace-bin

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

Shell-Agnostic Completions #2476

Closed jdugan6240 closed 1 month ago

jdugan6240 commented 1 month ago

Request

Currently, Carapace only supports generating shell completions for the shells it explicitly supports. This means that users of more niche shells such as hilbish cannot leverage Carapace at all.

In theory, this problem could be solved by simply merging support for those shells, but this would create a new problem - having to do this for every shell.

Proposed solution

Ideally, carapace would provide a means of generating completions for a given string regardless of the environment being run.

The fish shell, for instance, provides this functionality with the --do-complete option of its complete command. Given a passed string, it will generate completions similar to those seen when using fish's own tab-completion.

Carapace could work similarly, providing a do-complete command of its own to output completions for a given string.

This would allow any additional shells to simply call the Carapace binary whenever completions are needed, thus allowing Carapace to effortlessly support every shell.

Anything else?

Fish shell complete command reference: https://fishshell.com/docs/current/cmds/complete.html

Polar

Fund with Polar

rsteube commented 1 month ago

See export.

related https://github.com/carapace-sh/carapace-bin/issues/2382

jdugan6240 commented 1 month ago

Huh, I could have sworn I tried that...

Yes, this would work. Thanks!

(Also just realized I forgot to search the issues before posting - that's embarassing).