diff --git a/jbang/hello.java b/jbang/hello.java new file mode 100755 index 0000000000..4a457b153b --- /dev/null +++ b/jbang/hello.java @@ -0,0 +1,11 @@ +///usr/bin/env jbang "$0" "$@" ; exit $? +// //DEPS + +import static java.lang.System.*; + +public class hello { + + public static void main(String... args) { + out.println("Hello World"); + } +} diff --git a/jbang/hellocli.java b/jbang/hellocli.java new file mode 100755 index 0000000000..8722cb27b8 --- /dev/null +++ b/jbang/hellocli.java @@ -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 { + + @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; + } +} diff --git a/jbang/index.html b/jbang/index.html new file mode 100644 index 0000000000..bd34d026a3 --- /dev/null +++ b/jbang/index.html @@ -0,0 +1,18 @@ + + + + + + + JBang meets Quarkus + + + + + Go Say Hello! +

+ Powered by: + +

+ + \ No newline at end of file diff --git a/jbang/jbang-catalog.json b/jbang/jbang-catalog.json new file mode 100644 index 0000000000..2e30f0eb4a --- /dev/null +++ b/jbang/jbang-catalog.json @@ -0,0 +1,15 @@ +{ + "catalogs": {}, + "aliases": { + "hello": { + "script-ref": "hello.java" + }, + "hellocli": { + "script-ref": "hellocli.java" + }, + "jbangquarkus": { + "script-ref": "jbangquarkus.java" + } + }, + "templates": {} +} \ No newline at end of file diff --git a/jbang/jbangquarkus.java b/jbang/jbangquarkus.java new file mode 100755 index 0000000000..9e3cb5f69a --- /dev/null +++ b/jbang/jbangquarkus.java @@ -0,0 +1,21 @@ +///usr/bin/env jbang "$0" "$@" ; exit $? +// Update the Quarkus version to what you want here or run jbang with +// `-Dquarkus.version=` to override it. +//DEPS io.quarkus:quarkus-bom:${quarkus.version:2.4.0.Final}@pom +//DEPS io.quarkus:quarkus-resteasy +//JAVAC_OPTIONS -parameters + +//FILES META-INF/resources/index.html=index.html + +import javax.enterprise.context.ApplicationScoped; +import javax.ws.rs.GET; +import javax.ws.rs.Path; + +@Path("/hello") +@ApplicationScoped +public class jbangquarkus { + @GET + public String sayHello() { + return "Hello from Quarkus with jbang.dev"; + } +}