Giter Club home page Giter Club logo

Comments (5)

rvesse avatar rvesse commented on August 12, 2024

To support Bash completion you need to do the following:

  • Add @CompletionBehaviour annotations to options/arguments that need them. Note that you don't have to add these annotations at all as the basic annotations provide enough information to generate a basic Bash completion script
  • Create an instance of BashCompletionGenerator and parse your GlobalMetadata to it:
    BashCompletionGenerator<Object> generator = new BashCompletionGenerator<>(); generator.usage(metadata, output);
    This dumps the completion script to some OutputStream instance here specified by the output variable. Typically you will want this to be a FileOutputStream
  • You then need to source the script in your environment

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)

from airline.

ghxiao avatar ghxiao commented on August 12, 2024

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

from airline.

rvesse avatar rvesse commented on August 12, 2024

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

from airline.

rvesse avatar rvesse commented on August 12, 2024

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

from airline.

rvesse avatar rvesse commented on August 12, 2024

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

from airline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.