mbrubeck/compleat

Output Completion Script

ax3l opened this issue · 5 comments

ax3l commented

Hi,

can I use compleat to output a bash/zsh/fish/... completion script based on the tools usage signature (or --help) output instead of letting it auto-complete it interactively?

I know it's less fancy as the full compleat functionality but such a auto-generator would be super-handy for shipping completions and auto-generating them, e.g. before a software release. (It also just introduces a software dependency for the dev side but not for the user side.)

Yes, this could be done if someone can write a generator that turns the Compleat grammar into sh code that does the same thing that compleat does internally. I don't have the time to work on this myself right now, but would be happy to help if someone else does.

Hi @mbrubeck, are you still interested in this? I might give it a chance, although my haskell knowledge is extremely basic.

@fvictorio No, I'm not currently working in this. My own Haskell knowledge is quite rusty these days :)

ax3l commented

I would be still interested in using this (but have zero haskell knowledge) :)

Just FYI, I ended up doing something different (here's the repo if you are interested). The tl;dr is to have a intermediate representation of a completion system (in JSON in this MVP) to decouple building the representation from generating the scripts.

But I kind of like the syntax of the .usage files, so one idea is to make a tool that converts them to this JSON representation.

Anyway, sorry for saying I would work on this and then not doing it!