Commander

Simple command line option parser and GIT-alike command manager for JDK7+.

License

License

GroupId

GroupId

com.rfksystems
ArtifactId

ArtifactId

commander
Last Version

Last Version

1.0.5
Release Date

Release Date

Type

Type

jar
Description

Description

Commander
Simple command line option parser and GIT-alike command manager for JDK7+.
Project URL

Project URL

https://github.com/rfksystems/commander
Project Organization

Project Organization

RFK Systems
Source Code Management

Source Code Management

http://github.com/rfksystems/commander/tree/master

Download commander

How to add to project

<!-- https://jarcasting.com/artifacts/com.rfksystems/commander/ -->
<dependency>
    <groupId>com.rfksystems</groupId>
    <artifactId>commander</artifactId>
    <version>1.0.5</version>
</dependency>
// https://jarcasting.com/artifacts/com.rfksystems/commander/
implementation 'com.rfksystems:commander:1.0.5'
// https://jarcasting.com/artifacts/com.rfksystems/commander/
implementation ("com.rfksystems:commander:1.0.5")
'com.rfksystems:commander:jar:1.0.5'
<dependency org="com.rfksystems" name="commander" rev="1.0.5">
  <artifact name="commander" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.rfksystems', module='commander', version='1.0.5')
)
libraryDependencies += "com.rfksystems" % "commander" % "1.0.5"
[com.rfksystems/commander "1.0.5"]

Dependencies

test (2)

Group / Artifact Type Version
junit : junit jar 4.12
org.mockito : mockito-all jar 1.10.19

Project Modules

There are no modules declared in this project.

Commander

Simple command line option parser and GIT-alike command manager for JDK7+.

Maven Central Build Status

Example usage

import com.rfksystems.commander.Command;
import com.rfksystems.commander.Commander;
import com.rfksystems.commander.Input;
import com.rfksystems.commander.exception.*;

import java.io.PrintStream;

public class Main {
    public static void main(final String[] args) {
        final Commander commander = new Commander();
        commander.addCommand(new Command() {
            public String getName() {
                return "hello";
            }

            public String getUsage() {
                return "[--world]";
            }

            public String getDescription() {
                return "Some command that says hello";
            }

            public int execute(Input input, PrintStream output) throws RuntimeArgumentException {
                final String outputString = "Hello";
                if (input.arguments.containsKey("world")) {
                    outputString = outputString.concat(" world!");
                }
                output.println(outputString);
                return 0;
            }
        });
        try {
            commander.execute(args, System.out);
        } catch (final NoCommandGivenException | CommandUnknownException | RuntimeArgumentException | InputParseException e) {
            e.printStackTrace();
        }
    }
}

Installation

Maven

Available in Maven Central since 1.0.5

<dependency>
    <groupId>com.rfksystems</groupId>
    <artifactId>commander</artifactId>
    <version>${commander.version}</version>
</dependency>

License

Apache License, Version 2.0

com.rfksystems

RFK Systems

Versions

Version
1.0.5