Add jbang: single-file Java with JBang 0.132.1 on JDK 25 (deps, compact source files, Spring Boot, templates, native)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6ZEVHGaYy15HAxRzy
This commit is contained in:
Ankur Mhatre
2026-12-01 08:20:46 +05:30
co-authored by Claude Sonnet 5.5
parent 7c677a39d2
commit ddc3ec9d90
34 changed files with 639 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
//JAVA 25+
//DEPS info.picocli:picocli:4.7.7
import picocli.CommandLine;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.Parameters;
import java.util.concurrent.Callable;
/**
* A real command line tool in one file: argument parsing, --help and --version for free.
* The only build file is the //DEPS line above.
*/
@Command(name = "greeter", mixinStandardHelpOptions = true, version = "greeter 1.0",
description = "Greets people, optionally loudly.")
public class Greeter implements Callable<Integer> {
@Parameters(index = "0", description = "Who to greet.")
String name;
@Option(names = {"-l", "--loud"}, description = "Shout the greeting.")
boolean loud;
@Option(names = {"-n", "--times"}, defaultValue = "1", description = "Repeat count (default: ${DEFAULT-VALUE}).")
int times;
@Override
public Integer call() {
String msg = "Hello, " + name + "!";
for (int i = 0; i < times; i++) {
System.out.println(loud ? msg.toUpperCase() : msg);
}
return 0;
}
public static void main(String[] args) {
System.exit(new CommandLine(new Greeter()).execute(args));
}
}