initial jbang example
This commit is contained in:
27
jbang/hellocli.java
Executable file
27
jbang/hellocli.java
Executable file
@@ -0,0 +1,27 @@
|
||||
///usr/bin/env jbang "$0" "$@" ; exit $?
|
||||
//DEPS info.picocli:picocli:4.5.0
|
||||
|
||||
import picocli.CommandLine;
|
||||
import picocli.CommandLine.Command;
|
||||
import picocli.CommandLine.Parameters;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@Command(name = "hellocli", mixinStandardHelpOptions = true, version = "hellocli 0.1",
|
||||
description = "hellocli made with jbang")
|
||||
class hellocli implements Callable<Integer> {
|
||||
|
||||
@Parameters(index = "0", description = "The greeting to print", defaultValue = "World!")
|
||||
private String greeting;
|
||||
|
||||
public static void main(String... args) {
|
||||
int exitCode = new CommandLine(new hellocli()).execute(args);
|
||||
System.exit(exitCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer call() throws Exception { // your business logic goes here...
|
||||
System.out.println("Hello " + greeting);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user