mbrubeck / compleat

Generate command-line completions using a simple DSL.
http://limpet.net/mbrubeck/2009/10/30/compleat.html
472 stars 18 forks source link

Output Completion Script #19

Open ax3l opened 7 years ago

ax3l commented 7 years ago

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.)

mbrubeck commented 7 years ago

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.

fvictorio commented 4 years ago

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

mbrubeck commented 4 years ago

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

ax3l commented 4 years ago

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

fvictorio commented 4 years ago

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!