]> juplo.de Git - maven-thymeleaf-skin/commitdiff
Refined usage-description in `import-in-hugo.sh`
authorKai Moritz <kai@juplo.de>
Sun, 3 May 2026 08:08:39 +0000 (10:08 +0200)
committerKai Moritz <kai@juplo.de>
Sun, 3 May 2026 09:34:09 +0000 (11:34 +0200)
src/main/resources/import-in-hugo.sh

index 80c14a27c23496b36cac2ec29698ae5b78f239ab..77caf7832bbc991c2bdcc9559bb2399d4917d3d3 100644 (file)
@@ -1,20 +1,30 @@
 #!/usr/bin/env bash
 set -euo pipefail
 
+USAGE=$(
+  echo "Usage: $0 <HUGO_ROOT> [--base <path>] [--separator ] [ [ --current [<canonical>]] | [--archived [<canonical>]] ]";
+  cat << EOF
+
+--base      : Specifies the base-path for the rendered site.
+              If not specifed, the site is rendered as a root section.
+              The artifact-id and the version are always added to the
+              path.
+--current   : [DEFAULT]
+              Adds "url: <canonical>/<path_in_site>/" to front-matter.
+              If "<cononical>" is not specified, "<path>/<project>/"
+              is used.
+              Only one of "--current" and "--archived" can be used!
+--archived  : Adds "params.canonical=<canonical>/<path_in_site>/" to
+              front-matter.
+              If "<cononical>" is not specified, "<path>/<project>/"
+              is used.
+              Only one of "--current" and "--archived" can be used!
+EOF
+)
+
 if [ $# -lt 1 ]
 then
-  echo "Usage: $0 <HUGO_ROOT> [--base <path>] [ [ --current [<canonical>]] | [--archived [<canonical>]] ]" 
-  echo
-  echo "--base     : Specifies the base-path for the rendered site."
-  echo "             If not specifed, the site is rendered as a root section."
-  echo "             The artifact-id and the version are always added to the path."
-  echo "--current  : [DEFAULT]"
-  echo "             Adds "url: <canonical>/<path_in_site>/" to front-matter."
-  echo "             If "<cononical>" is not specified, "<path>/<project>/" is used."
-  echo "             Only one of "--current" and "--archived" can be used!"
-  echo "--archived : Adds "params.canonical=<canonical>/<path_in_site>/" to front-matter."
-  echo "             If "<cononical>" is not specified, "<path>/<project>/" is used."
-  echo "             Only one of "--current" and "--archived" can be used!"
+  echo "$USAGE"
   exit 1
 fi
 
@@ -74,7 +84,9 @@ while [[ $# -gt 0 ]]; do
       fi
       ;;
     *)
-      echo "Unknown parameter: $1"
+      echo "ERROR -- Unknown parameter: $1"
+      echo
+      echo "$USAGE"
       exit 1
       ;;
   esac
@@ -83,6 +95,8 @@ done
 if [[ "$CURRENT" -eq 1 && "$ARCHIVED" -eq 1 ]]
 then
   echo "ERROR -- Only one of "--current" and "--archived" can be specified!"
+      echo
+      echo "$USAGE"
   exit 1
 fi
 if [[ "$CURRENT" -eq 0 && "$ARCHIVED" -eq 0 ]]