twolfson / commander-completion

Shell completion for commander.js
The Unlicense
26 stars 4 forks source link

Completion in bash #6

Open tkarls opened 7 years ago

tkarls commented 7 years ago

Hi

I would like to use this is my commander based app that I have. But I don't understand exactly what is needed to get completion working in a bash terminal.

Do you still need a bash completion script in addition to use commander-competion? Is that script auto generated by command-completion somehow?

twolfson commented 7 years ago

It's been a while since I developed on this so my memory might be foggy. I think we got everything working but had no way to reliably test our shell integration so we intentionally left it out.

There's a working copy here:

https://github.com/twolfson/foundry/blob/4.3.3/bin/completion/foundry

I'm confident it works for bash but I'm not sure of its zsh support sadly =/

commander-completion was designed to be integrated as a command itself in the program and that script invokes <command> completion

tkarls commented 7 years ago

Thanks for your quick reply!

I see, I did not undertand it was supposed to be used that way. I have added a "completion" command to my program now and tested to manually call that command. It seems to work nicely.

I will attempt to adjust the file you linked to now and see if I can get bash to invoke it as well. Although the syntax look horrible :)

tkarls commented 7 years ago

Ok, I got it working now with the help of your example!