docs: Update help, add comments

This commit is contained in:
Serge Guzik 2019-02-11 16:40:28 +02:00
parent 143f9d2b43
commit f74f905f74

16
warp4j
View File

@ -2,12 +2,12 @@
function print_help { function print_help {
echo echo
echo 'Usage: warp4j [options] <file.jar>' echo 'Usage: warp4j [options] <app.jar>'
echo echo
echo 'Turn Java application into self-contained executable' echo 'Turn JAR (java application archive) into self-contained executable'
echo echo
echo 'Options:' echo 'Options:'
echo ' --java-version <version>' echo ' -j, --java-version <version>'
echo ' override JDK/JRE version' echo ' override JDK/JRE version'
echo ' examples: "11", "11.0", "11.0.2", "11.0.2+9"' echo ' examples: "11", "11.0", "11.0.2", "11.0.2+9"'
echo ' default: 11' echo ' default: 11'
@ -27,15 +27,11 @@ function print_help {
echo ' --jvm-options <options>' echo ' --jvm-options <options>'
echo ' passed to java like this:' echo ' passed to java like this:'
echo ' "java <options> -jar <jar file>"' echo ' "java <options> -jar <jar file>"'
echo ' --launcher-shell <path to shell script>' echo ' -h, --help show this help'
echo ' custom launcher for Linux and macOS'
echo ' (not implemented)'
echo ' --launcher-cmd <path to cmd script>'
echo ' custom launcher for Windows'
echo ' (not implemented)'
exit exit
} }
# exit top level program from subshell
trap "exit 1" TERM trap "exit 1" TERM
export TOP_PID=$$ export TOP_PID=$$
function fail() { function fail() {
@ -86,6 +82,7 @@ function check_deps() {
check_deps check_deps
# show help if no arguments specified
if [[ $# -eq 0 ]]; then if [[ $# -eq 0 ]]; then
print_help print_help
exit exit
@ -153,6 +150,7 @@ while [[ $# -gt 0 ]]; do
done done
set -- "${POSITIONAL[@]}" # restore positional arguments set -- "${POSITIONAL[@]}" # restore positional arguments
# apart from options only one argument is allowed
if [[ $# -gt 1 ]]; then if [[ $# -gt 1 ]]; then
echo "Error: Too many arguments: $@, expecting only jar name" >&2 echo "Error: Too many arguments: $@, expecting only jar name" >&2
print_help print_help