Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

47 lines (33 sloc) 1.399 kb


This is a library to help developers build neatly formatted and easy to understand command line parsing.


This example can be run with the command java FlagsStarter --help which will print the command line help, or java FlagsStarter --text HelloWorld --times 2 --active true which will print "HelloWorld" 2 times.

import org.cloudname.flags.Flag;
import org.cloudname.flags.Flags;

public class FlagsStarter {

    @Flag(name="text", defaultValue="Default boring text", description="Output text")
    public static String text;

    @Flag(name="times", defaultValue="1", required=true, description="Number of times to print output text")
    public static int times;

    @Flag(name="active", defaultValue="false", required=true, description="Should I run the task?")
    public static boolean active;

    public FlagsStarter() {
        if (active) {
            for (int i = 0; i < times; i++) {

    * @param args
    public static void main(String[] args) {
        Flags flags = new Flags()

        //quit if help has been called
        if (flags.helpCalled())

        FlagsStarter starter = new FlagsStarter();

Jump to Line
Something went wrong with that request. Please try again.