CLI-Parsec - a declarative CLI-Parser-Framework

CLI-Parsec is a declarative CLI-Parser-Framework for Java. It is based on annotations and aims to ease defining and parsing command line interfaces.

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

de.dr1fter
ArtifactId

ArtifactId

de.dr1fter.cli-parsec
Last Version

Last Version

0.2.1
Release Date

Release Date

Type

Type

jar
Description

Description

CLI-Parsec - a declarative CLI-Parser-Framework
CLI-Parsec is a declarative CLI-Parser-Framework for Java. It is based on annotations and aims to ease defining and parsing command line interfaces.
Project URL

Project URL

https://github.com/dr1fter/
Source Code Management

Source Code Management

https://github.com/dr1fter/cli-parsec

Download de.dr1fter.cli-parsec

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
com.google.guava : guava jar 15.0

test (3)

Group / Artifact Type Version
org.hamcrest : hamcrest-core jar 1.3
org.hamcrest : hamcrest-library jar 1.3
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

CLI-Parsec - a declarative CLI parser framework for Java

WHAT IS IT?

CLI-Parsec is a Java library that aims to ease the task of implementing command line interfaces. It uses a declarative approach based on Java annotations. The supported command line style adheres to the recommendations of POSIX (with some GNU extensions, such as long options). CLI-Parsec was inspired by both the Java 'jCommander'and the C# 'Command Line Parser Library'.

WHY USE IT?

The topmost design goal of CLI-Parsec is ease-of-use in combination with a consequent declaration-only approach. It will help you implement command line interfaces with a minimum amount of coding (as simple as creating a POJO and annotating its fields). CLI-Parsec is especially targeted towards complex command line interfaces (arbitrarily nested sub-commands with individual options).

HOW TO USE IT?

After its release to maven central, use the following dependency to reference the library:

<dependency>
  <groupId>de.dr1fter</groupId>
  <artifactId>de.dr1fter.cli-parsec</artifactId>
  <version>0.2.1</version>
</dependency>

Declare a type and annotate its fields in order to define the command line interface:

class MyOptions
{
  @Option(shortOption="x")
  boolean optionx;

  @Option
  String username;
}

Parse command line arguments:

MyOptions opts = new MyOptions();
CliParser.create().parse(opts, "-x", "--username", "myName");
//the fields of 'opts' are now initialised according to the command line args

Versions

Version
0.2.1
0.2
0.1-MS7
0.1-MS6
0.1-MS5
0.1-MS4
0.1-MS3
0.1-MS2
0.1-MS1