rvesse / airline

Java annotation-based framework for parsing Git like command line structures with deep extensibility
https://rvesse.github.io/airline/
Apache License 2.0
128 stars 20 forks source link

Help of Bash Complemention #43

Closed ghxiao closed 6 years ago

ghxiao commented 8 years ago

Hi,

Thanks for this amazing project! I am using the airline library for the CLI of the ontop project. It works very well.

I noticed airline supports bash completion and want to use it in my project. However, I am not sure how to use it. I attached the @CompletionBehaviour annotations to some of the fields, but it seem not work. I guess I also need to generate a bash_completion file for bash. Maybe I overlooked something, but I searched around and could not found a guide. Is there some document or example code?

Thanks in advance

rvesse commented 8 years ago

To support Bash completion you need to do the following:

I will leave this open as this definitely needs to be added to the new User Guide which I am currently working on - http://rvesse.github.io/airline/guide/ (#35)

ghxiao commented 8 years ago

Thanks a lot. I tried but stuck at constructing GlobalMetadata object. Is there some example on GlobalMetadata?

rvesse commented 8 years ago

If you have created a parser for your CLI (i.e. you have a Cli instance) then you can simply call getMetadata() on this to get the meta-data. We don't currently have a way to generate completion for a SingleCommand instance

rvesse commented 6 years ago

Hoping to get a complete version of the User Guide prepared in the coming months so adding this to the next milestone

rvesse commented 6 years ago

Now documented at http://rvesse.github.io/airline/guide/help/bash.html