Skip to content
/ jargs Public
forked from amberhassaan/jargs

GNU getopt-style command-line argument parser for Java, used in JBoss

License

Notifications You must be signed in to change notification settings

mwnorman/jargs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JArgs command-line argument parsing library
===========================================

Copyright (c) 2001-2003 Steve Purcell.
Copyright (c) 2002      Vidar Holen.
Copyright (c) 2002      Michal Ceresna.
Copyright (c) 2005      Ewan Mellor.
Copyright (c) 2011      M. Amber Hassaan (generics, replace Vector/Hashtable
                        w List/ArrayList/Map/HashMap
Copyright (c) 2012      M. Norman
                        Switch to LinkedHashMap so that options print in the
                          order in which they are added
                        Add support for optional arguments by creating a new
                          type of OptionValueParser that uses <java.lang.Void>
                          as its bound-type in OptionValueParser<T>
                        Support adding default value for an option
                        Support testing 'isFound()' for an option
                        move to JUnit4
                        fix printUsage() formatting:
                           add [] indication for optional args
                           add printUsage 'preAmble' and 'postScript' strings
                           indenting
              2013      M. Norman
                        mavenize project

All rights reserved.

Released under the terms of the BSD licence.  See the file LICENCE for details.

Prerequisites
-------------
For each prerequisite, the version with which JArgs has been tested is given 
in parentheses.  Any version equal to or later than this should work.

JUnit4 (4.11) by Eric Gamma, et al, from http://www.junit.org/
JUnit is used to run the unit tests, and is not needed to run the library itself.

NB - the use of generics and @Override annotations on Interface-implementations
     means that Java SE 6 is required.

Installation
------------
To compile, test and package the code into a jar file, run:

    mvn package

There are also settings in the pom.xml file to deploy (via ftp) the maven-
generated artifacts (i.e. jar file, generated maven site) to a local server:

    mvn deploy site-deploy
    
You will need to alter the <distributionManagement> section:

...
    <distributionManagement>
        <repository>
            <id>your_local_server</id>
            <url>ftp://a.b.c.d/somedir/maven2/</url>
        </repository>
        <site>
          <id>your_local_server</id>
          <url>ftp://a.b.c.d/somedir/jargs</url>
        </site>
    </distributionManagement>

as well as your ~/.m2/settings.xml file:

...
    <servers>
        <server>
            <id>your_local_server</id>
            <username>user</username>
            <password>password</password>
        </server>
    </servers>
...

To use the library with your own code, add the following to your pom.xml file:

...
    <properties>
        <jargs.version>1.11</jargs.version>
    </properties>

    <repositories>
        <repository>
            <id>your_local_server</id>
            <url>http://a.b.c.d/somedir/maven2</url>
        </repository>
    </repositories>
    
    <dependencies>
 ...
        <dependency>
            <groupId>jargs.gnu</groupId>
            <artifactId>jargs</artifactId>
            <version>${jargs.version}</version>
        </dependency>
    </dependencies>
...
</project>

Documentation
-------------

The main documentation is the detailed working example in
src/jargs/examples/gnu/OptionTest.java, plus the generated
javadoc.

Package contents
----------------

  src/jargs/gnu          -- The library itself.
  src/jargs/examples/gnu -- Examples showing how to use the library.
  src/jargs/test/gnu     -- JUnit tests.
  target/                -- Maven-generated artifacts: classes, jar, javadocs, etc.

About

GNU getopt-style command-line argument parser for Java, used in JBoss

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%