From 2157ebeb1f39131280861dbacaa522c4bb008a81 Mon Sep 17 00:00:00 2001 From: Romain Manni-Bucau Date: Mon, 11 Dec 2023 09:32:27 +0100 Subject: [PATCH] [asciidoctor-java] adding help in minimalistic main --- .../main/java/io/yupiik/asciidoc/launcher/Main.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/asciidoc-java/src/main/java/io/yupiik/asciidoc/launcher/Main.java b/asciidoc-java/src/main/java/io/yupiik/asciidoc/launcher/Main.java index c1f960c3..f4656758 100644 --- a/asciidoc-java/src/main/java/io/yupiik/asciidoc/launcher/Main.java +++ b/asciidoc-java/src/main/java/io/yupiik/asciidoc/launcher/Main.java @@ -34,6 +34,11 @@ private Main() { } public static void main(final String... args) throws IOException { // todo: complete impl, this is just an undocumented boostrap main for testing purposes + if (args.length== 0) { + System.err.println(error()); + return; + } + final var attributes = new HashMap(); Function, Visitor> renderer = SimpleHtmlRenderer::new; ContentResolver resolver = null; @@ -54,7 +59,7 @@ public static void main(final String... args) throws IOException { // todo: comp } if (input == null) { - throw new IllegalArgumentException("No --input argument, ensure to set --input "); + throw new IllegalArgumentException("No --input argument, ensure to set --input \n" + error()); } if (resolver == null) { resolver = ContentResolver.of(input.toAbsolutePath().getParent()); @@ -74,4 +79,8 @@ public static void main(final String... args) throws IOException { // todo: comp System.out.println(html.result()); } } + + private static String error() { + return "Usage:\n\nasciidoctor-java --input file.adoc [--base includeBasePath/] [--output output.html] [--attribute myattribute=myvalue]*"; + } }