Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
gschueler committed Nov 21, 2016
1 parent 7db04c3 commit 0b32395
Showing 1 changed file with 60 additions and 3 deletions.
63 changes: 60 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# CLI Toolbelt

Use simple annotations to define an easy commandline interface for your Java code.
Java Commandline Interface in three lines of code... **or your money back**.

(Free)

# Example

Expand Down Expand Up @@ -48,7 +50,7 @@ Builtin features:

* ANSI colorized output
* Simple argument parsing
* Or plugin in a more advanced parser like [JewelCLI][]
* Or plugin in a more advanced parser like [JewelCLI][] (see [below](#using-jewelcli))
* Support for printing basic Java container objects in a nice way
* Support for YAML and JSON formatted output for scripting

Expand All @@ -58,6 +60,8 @@ Builtin features:

Find the latest version from the [Releases][] section, import via [jitpack.io](https://jitpack.io/#simplifyops/cli-toolbelt):

[Releases]: https://github.com/simplifyops/cli-toolbelt/releases

[![](https://jitpack.io/v/simplifyops/cli-toolbelt.svg)](https://jitpack.io/#simplifyops/cli-toolbelt)

Gradle build:
Expand All @@ -71,7 +75,9 @@ dependencies{
}
~~~

[Releases]: https://github.com/simplifyops/cli-toolbelt/releases
# Javadoc

[via jitpack.io](https://jitpack.io/com/github/simplifyops/cli-toolbelt/toolbelt/master-SNAPSHOT/javadoc/)

# In Progress

Expand Down Expand Up @@ -234,3 +240,54 @@ This will define an interface like:
$ java ... First second third

Third level nested command

# Using JewelCLI

[JewelCLI][] is a useful interface-based commandline argument parser. You
can use it with cli-toolbelt:


Add `toolbelt-jewelcli` dependency to your Gradle build:

~~~ {.groovy}
repositories {
maven { url "https://jitpack.io" }
}
dependencies{
compile 'com.github.simplifyops.cli-toolbelt:toolbelt:VERSION'
compile 'com.github.simplifyops.cli-toolbelt:toolbelt-jewelcli:VERSION'
}
~~~

Add `JewelInput` as a InputParser to your ToolBelt:

~~~{.java}
import com.simplifyops.toolbelt.input.jewelcli.JewelInput;
...
Tool cli = ToolBelt.belt(name)
.add(new MyCommand())
.commandInput(new JewelInput())
.build();
~~~

In the `@Command` methods of `MyCommand`, use a parameter annotated with the
JewelCLI commandline argument annotations:

~~~{.java}
import com.lexicalscope.jewel.cli.Option;
interface Widget{
@Option(shortName="n",description="Widget name")
String getName();
}
@Command(description = "Requeques widgets")
public boolean requeue(Widget options, CommandOutput out) {
out.output("Requeueing widget "+options.getName()+"...");
//...
}
~~~

See the other annotations available from [JewelCLI][]


[JewelCLI]: http://jewelcli.lexicalscope.com/

0 comments on commit 0b32395

Please sign in to comment.