asciidoctor / asciidoctorj

:coffee: Java bindings for Asciidoctor. Asciidoctor on the JVM!
http://asciidoctor.org
Apache License 2.0
627 stars 172 forks source link

CLI should exit with non-zero status when e.g. missing include files #1113

Closed pasieronen closed 2 years ago

pasieronen commented 2 years ago

The Ruby asciidoc CLI has option --failure-level which forces the CLI to exit with non-zero status code if the specified logging level (severity) is reached. See: https://github.com/asciidoctor/asciidoctor/pull/2674, https://github.com/asciidoctor/asciidoctor/issues/2003, https://github.com/asciidoctor/asciidoctor/issues/854

It would be nice to have the same feature in AsciidoctorJ CLI, too. (To e.g. catch missing included files in CI builds)

I haven't touched AsciidoctorJ code before, but it looks like the relevant Ruby code is in https://github.com/asciidoctor/asciidoctor/blob/main/lib/asciidoctor/cli/invoker.rb , which AsciidoctorJ does not call.

Here's a quick attempt at doing what the Ruby CLI does: https://github.com/pasieronen/asciidoctorj/commit/f94d332eb7aaf468e4f1674bf650a5c3037fa095 Any thoughts on that?

robertpanzer commented 2 years ago

Thanks, this is a great start. Do you want to open a PR? Then we can continue discussing on that..