Conversation
|
only openjdk 10 build is failing with the following error: |
621d58e to
6ac0eb6
Compare
|
@ancho There is change is one behavior - With |
|
Looks like it's time to really replace args4j? Yay! I haven't reviewed this one, but just wanted to note that I once created another replacement in pull request #120. It must be really really outdated by now, but just in case you want to compare I thought I provide a link here. Feel free to ignore it! |
|
@manikmagar thanks for catching this. I will restore that behaviour. |
|
@lefou interesting. will have a look. even though i think that picocli is the way to go. it has a lot of nice features like creating manpages, autocomplete scripts and supports internationalization. see https://picocli.info/autocomplete.html and https://picocli.info/#_generate_man_page_documentation |
|
Something related to what @lefou also mentioned in the discussion on his PR, make it easier when using JBake as library. |
|
Yeah. A cleanup of everything cli related needs to be done. And to be honest I would move everything cli related to the jbake-dist repo (which was originaly named jbake-cli). What use case do you have in mind? |
|
No specific use case right now. Seeing Tobias's comment reminded me of the similar issue I ran into when using Liquibase as a library. Good that their run method is public and I could switch from main to calling run directly. We could defer it until someone ask for it. |
|
Yeah, having a |
|
Allright. That's what the proteced run method already does ;) |
|
It's more the integration point (like the use as a library). E.g. jbake is integrated in different build tools. The easiest integration is to just run a sub-process and evaluating the exit code. This is the most stable integration, but also gives you the least control, it's also the slowest and heaviest, as you need to create a new process, need more memory, etc. Next level we allow with the pulbic run method: We can just load jbake as library or use an isolated classloader, but still don't need to learn the whole JBake API. We can still (re-)use the construction logic for the commandline, but without the extra process. We can use the same (hot) JVM. We can even give the user the choice to decide (classloader or process) without much efforts. But the integration logic is very simple, just some strings. It's even easy to do in reflection (e.g. when using an isolated classloaded without any extra glue API). It's also very stable against all API refactorings as long as the cmdline keeps compatible. |
|
See https://github.com/lefou/mill-jbake. From the plugin documentation:
Supported value:
Defaults to The current implementation needs to use a custom SecurityManager to intercept the |
|
Ok. Got it. Thanks for the clarification. That shifts my perspective. So lets do this. Like new JBakeException("something went wrong") // ex.exit == 1 Where SystemExit has predefined error codes. |
|
Yeah, looks reasonable. Personally, I would move the exit code to the first argument and avoid the default. |
a57a960 to
3956f60
Compare
| public enum SystemExit { | ||
| ERROR(1), | ||
| CONFIGURATION_ERROR(2), | ||
| INIT_ERROR(3), | ||
| SERVER_ERROR(4); |
There was a problem hiding this comment.
You forgot the success case (exit code 0).
There was a problem hiding this comment.
Yeah. I can add that. But I don't see why I would throw an exception and exit with 0.
There was a problem hiding this comment.
I've found these useful, but my understanding of JBakes codebase is a very dated, so there is probably currently no use for it. E.g. I sometime use it to exit early, e.g. when the user added a -h to the cmdline to get the help.
There was a problem hiding this comment.
-h or calling jbake without arguments prints the usage information. As there was no exception thrown the status code of the cli is implicitly 0.
jbake -h; echo "status: $?"
JBake v2.7.0-SNAPSHOT (2020-05-13 22:55:59nachm.) [http://jbake.org]
Usage: jbake [-i[=-i] [-t=<template>]] [-bhs] [--reset] [<source>]
[<destination>]
JBake is a Java based, open source, static site/blog generator for developers &
designers
[<source>] source folder of site content (with templates and
assets), if not supplied will default to current
directory
[<destination>] destination folder for output, if not supplied will
default to a folder called "output" in the current
directory
-b, --bake performs a bake
-h, --help prints this message
--reset clears the local cache, enforcing rendering from scratch
-s, --server runs HTTP server to serve out baked site, if no <value>
is supplied will default to a folder called "output"
in the current directory
JBake initialization
-i, --init[=-i] initialises required folder structure with default
templates (defaults to current directory if <value>
is not supplied)
-t, --template=<template>
use specified template engine for default templates
(uses Freemarker if <value> is not supplied)
status: 0
There was a problem hiding this comment.
I could move the internal SystemExit class and add the SUCCESS status so a user can use it. What do you think?
There was a problem hiding this comment.
Success execution with 0 looks good to me.
3956f60 to
ee490b4
Compare
jonbullock
left a comment
There was a problem hiding this comment.
Looks good, lots of scope for improvement of the CLI with this.
9cb42b5 to
5391a3b
Compare
|
Marked it for 2.7.0 so it's reviewed. |
5391a3b to
96156b0
Compare
|
Should be merged and aligned after #615 |
using https://github.com/remkop/picocli as a replacement for args4j.