Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sviperll/easycli4j
Java library for command line arguments processing
https://github.com/sviperll/easycli4j
Last synced: 5 days ago
JSON representation
Java library for command line arguments processing
- Host: GitHub
- URL: https://github.com/sviperll/easycli4j
- Owner: sviperll
- License: bsd-3-clause
- Created: 2013-07-09T11:09:44.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-01-13T13:18:57.000Z (almost 9 years ago)
- Last Synced: 2024-10-12T07:16:47.081Z (about 1 month ago)
- Language: Java
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
Chicory CLI
===========Chicory CLI is a command line parsing library.
Chicory CLI is part of Chicory.
Licence
-------Chicory CLI is provided by means of BSD-3 Clause Licence.
Usage
-----### Maven ###
com.github.sviperll
easycli4j
0.18
Changelog
---------Since 0.18
* Switch to chicory version 0.18.
Example
-------Here is a full Hello world example
```java
class Hello {public static void main(String[] args) {
Hello hello = new Hello();
CLISpecification cli = new CLISpecification(System.out);
cli.add('n', "name", "Your name", CLIHandlers.string(hello.name));
cli.add("prefix", "Prefix for your name, i. e. Mr, Mrs, Dr, Sir", CLIHandlers.string(hello.prefix));
try {
cli.run(args);
application.run();
} catch (CLIException ex) {
System.out.println(ex.getMessage());
System.out.println("usage: hello [OPTIONS]");
try {
cli.usage();
} catch (IOException ex1) {
ex1.printStackTrace(System.out);
}
} catch (IOException ex) {
ex.printStackTrace(System.out);
}
}private Property name = new Property(null);
private Property prefix = new Property("Mr.");private void run() {
System.out.println("Hello " + prefix.get() + " " + name.get());
}}
```When you compile it and run like
java -jar hello.jar -n John --prefix=Sir.
You'll get the following
Hello Sir. John
You can get usage-message like this:
java -jar hello.jar -h
You'll get the following answer
Unknown option -h
usage: hello [OPTIONS]
-n OPTION Your name
--name=OPTION Your name
--prefix=OPTION Prefix for your name, i. e. Mr, Mrs, Dr, Sir (default Mr.)