JCommander

A Java framework to parse command line options with annotations. This version has been customised for use in PressGang.

License

License

Categories

Categories

JBoss Container Application Servers JCommander User Interface CLI
GroupId

GroupId

org.jboss.pressgang.ccms
ArtifactId

ArtifactId

jcommander-pressgang
Last Version

Last Version

1.24
Release Date

Release Date

Type

Type

jar
Description

Description

JCommander
A Java framework to parse command line options with annotations. This version has been customised for use in PressGang.
Source Code Management

Source Code Management

https://github.com/pressgang-ccms/jcommander-pressgang

Download jcommander-pressgang

How to add to project

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

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

JCommander

This is an annotation based parameter parsing framework for Java.

Here is a quick example:

public class JCommanderTest {
  @Parameter
  public List<String> parameters = Lists.newArrayList();

  @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity")
  public Integer verbose = 1;

  @Parameter(names = "-groups", description = "Comma-separated list of group names to be run")
  public String groups;

  @Parameter(names = "-debug", description = "Debug mode")
  public boolean debug = false;
}

and how you use it:

JCommanderTest jct = new JCommanderTest();
String[] argv = { "-log", "2", "-groups", "unit", "a", "b", "c" };
new JCommander(jct, argv);

Assert.assertEquals(jct.verbose.intValue(), 2);

The full doc is available at http://beust.com/jcommander

org.jboss.pressgang.ccms

Versions

Version
1.24