Airline

Airline is an annotation-driven Java library for building Command Line Interfaces (CLIs), it supports simple commands all the way through to complex Git style CLIs with groups and user defined command aliases.

Airline aims to reduce the boiler plate code typically associated with CLIs in Java, many common behaviours can be achieved purely with annotations and zero user code. Let’s take a look at an ultra simple example:

package com.github.rvesse.airline.examples.userguide;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.github.rvesse.airline.SingleCommand;
import com.github.rvesse.airline.annotations.Arguments;
import com.github.rvesse.airline.annotations.Command;
import com.github.rvesse.airline.annotations.Option;

@Command(name = "getting-started", description = "We're just getting started")
public class GettingStarted {

    @Option(name = { "-f", "--flag" }, description = "An option that requires no values")
    private boolean flag = false;

    @Arguments(description = "Additional arguments")
    private List<String> args;

    public static void main(String[] args) {
        SingleCommand<GettingStarted> parser = SingleCommand.singleCommand(GettingStarted.class);
        GettingStarted cmd = parser.parse(args);
        cmd.run();
    }

    private void run() {
        System.out.println("Flag was " + (this.flag ? "set" : "not set"));
        if (args != null)
            System.out.println("Arguments were " + StringUtils.join(args, ","));
    }
}

This is explained in depth in the Introduction to Airline but essentially we had to do the following:

How to Use

Please start reading the User Guide to learn how to use Airline for your applications.

Get Airline

You can get Airline from Maven central by specifying the following Maven coordinates:

<dependency>
  <groupId>com.github.rvesse</groupId>
  <artifactId>airline</artifactId>
  <version>X.Y.Z</version>
</dependency>

Where X.Y.Z is your desired version, the current stable release is 3.0.0

Dependencies

The core airline library has an intentionally minimal set of dependencies, these are currently as follows:

Note that the additional modules e.g. airline-help-external, airline-jpms-resources etc may have additional dependencies beyond the above. Please refer to mvn dependency:tree output on your project to see exactly what dependencies different modules bring in.

License

Airline is open source software licensed under the Apache License 2.0 and this license also applies to the documentation found here.

Please see license.txt in this repository for further details

Acknowledgements

This project was forked from http://github.com/airlift/airline and would not exist at all were it not for that library.

This website is built with Jekyll, it uses the following 3rd party resources:

All 3rd party resources used on the website are licensed under the stated open source licenses.

Content on this website is licensed under the same Apache License 2.0 used for the library as stated in the above License section.