#!/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
fi
;;
*)
- echo "Unknown parameter: $1"
+ echo "ERROR -- Unknown parameter: $1"
+ echo
+ echo "$USAGE"
exit 1
;;
esac
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 ]]