Skip to content

Commit

Permalink
[asciidoctor-java] adding help in minimalistic main
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Dec 11, 2023
1 parent 499a2af commit 2157ebe
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String>();
Function<Map<String, String>, Visitor<String>> renderer = SimpleHtmlRenderer::new;
ContentResolver resolver = null;
Expand All @@ -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 <path>");
throw new IllegalArgumentException("No --input argument, ensure to set --input <path>\n" + error());
}
if (resolver == null) {
resolver = ContentResolver.of(input.toAbsolutePath().getParent());
Expand All @@ -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]*";
}
}

0 comments on commit 2157ebe

Please sign in to comment.