jcommander-addons

The goal of the JCommander-Addons project is to provide any and all JCommander converters and validators an advanced applications will need. Feel free to submit a pull-request at https://github.com/garydgregory/jcommander-addons

License

License

Categories

Categories

JCommander User Interface CLI
GroupId

GroupId

com.garygregory
ArtifactId

ArtifactId

jcommander-addons
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

jcommander-addons
The goal of the JCommander-Addons project is to provide any and all JCommander converters and validators an advanced applications will need. Feel free to submit a pull-request at https://github.com/garydgregory/jcommander-addons
Project URL

Project URL

https://github.com/garydgregory/jcommander-addons
Project Organization

Project Organization

Gary Gregory
Source Code Management

Source Code Management

https://github.com/garydgregory/jcommander-addons

Download jcommander-addons

How to add to project

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

Dependencies

compile (1)

Group / Artifact Type Version
com.beust : jcommander jar 1.48

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
org.hamcrest : hamcrest-all jar 1.3
com.h2database : h2 jar 1.4.192

Project Modules

There are no modules declared in this project.

jcommander-addons

JCommander is a small Java framework that makes it simple to parse command line parameters.

The goal of the JCommander-Addons project is to provide any and all JCommander converters and validators an advanced applications will need.

Feel free to submit a pull-request and examine the sources and build site.

Build Status Build status Coverage Status Maven Central

Examples

To convert a command line argument into a Duration object, you write:

@Parameter(names = { "--duration" }, converter = DurationConverter.class)
private Duration duration;

Here is a complete program using a LocalDate:

package com.garygregory.jcommander.examples;

import java.time.LocalDate;

import com.beust.jcommander.JCommander;
import com.beust.jcommander.Parameter;
import com.garygregory.jcommander.converters.time.LocalDateConverter;

public class SimpleExample {

    @Parameter(
      names = { "--dob", "-d" }, 
      converter = LocalDateConverter.class, 
      required = true, 
      description = "Birthday in the format YYYY-MM-DD, for example 2007-12-03")
    LocalDate localDate;

    public static void main(String... args) {
        SimpleExample main = new SimpleExample();
        new JCommander(main, args);
        main.run();
    }

    public void run() {
        System.out.printf("You were born on a %s.", localDate.getDayOfWeek());
    }

}

Converters

Our Converters include:

Crypto Converters

Lang Converters

Math Converters

Net Converters

Net SSL Converters

NIO Converters

Security Converters

Security Certificate Converters

SQL Converters

Time Converters

Util Converters

XML Converters

Status

Build Status Coverage Status Maven Central

Building

Testing

To make sure everything is OK, build from first principles and run all the tests:

mvn clean test

Validating a patch or pull request

If you want to submit a patch or pull request, make sure all is well:

mvn apache-rat:check
mvn clirr:check
mvn clean site

Deploying a SNAPSHOT

To deploy a SNAPSHOT build to the SNAPSHOT repository, run:

mvn clean deploy

Generating the site

The site is generated in target/docs and manually copied to the docs folder for publication to GitHub Pages at https://garydgregory.github.io/jcommander-addons.

To generate the site run:

mvn clean site site:stage -DstagingDirectory=target/docs

Releasing a new version

Make sure all is well in your development branch:

mvn apache-rat:check
mvn clirr:check
mvn clean site

Create a clean clone and make sure all is well:

git clone https://github.com/garydgregory/jcommander-addons.git jcommander-addons-1.0.0-rc1
cd jcommander-addons-1.0.0-rc1
mvn apache-rat:check
mvn clirr:check
mvn clean site

Set the version from SNAPSHOT to normal and create a signed tag:

mvn versions:set -DnewVersion=1.0.0 -DgenerateBackupPoms=false
git commit -am "Update version numbers for release jcommander-addons 1.0.0"
mvn deploy -Prelease
git tag -s 1.0.0 -m "Tag release jcommander-addons 1.0.0" -u "[email protected]"
git push origin 1.0.0

Now reset the version to the next version:

mvn versions:set -DnewVersion=1.1.0-SNAPSHOT -DgenerateBackupPoms=false
git commit -am "Update to the version to 1.1.0-SNAPSHOT after releasing 1.0.0"
git push

Versioning

This project follows Semantic Versioning.

Versions

Version
1.0.0