From 0dbb5a9f73f35899943532c0559855db3e11808c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 4 May 2026 22:27:14 +0200 Subject: [PATCH] WIP --- src/main/resources/import-in-hugo.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/resources/import-in-hugo.sh b/src/main/resources/import-in-hugo.sh index b263652..89124c2 100644 --- a/src/main/resources/import-in-hugo.sh +++ b/src/main/resources/import-in-hugo.sh @@ -2,13 +2,16 @@ set -euo pipefail USAGE=$( - echo "Usage: $0 [--base ] [ [ --current []] | [--archived [] [--canonical ]] ]"; + echo "Usage: $0 [--base ] [--project ][ [ --current []] | [--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. +--project : Specifies the name of the project for path and url + (Default: artifact-id of the maven-project). + artifact-id and the version (Default: "/"). --current : [DEFAULT] Sets "url: //", "params.current=true" and "params.canonical = /" in @@ -38,6 +41,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) HUGO_ROOT="${1%%/}" shift +PROJECT="" CURRENT=0 ARCHIVED=0 URL="" @@ -65,6 +69,16 @@ while [[ $# -gt 0 ]]; do fi shift 2 ;; + --project) + if [[ $# -lt 2 ]] + then + echo "ERROR -- Parameter for --project is missing!" + exit 1 + fi + PROJECT="${2%%/}" + PROJECT="${PROJECT##/}" + shift 2 + ;; --current) CURRENT=1 if [[ $# -lt 2 ]] @@ -92,7 +106,7 @@ while [[ $# -gt 0 ]]; do --canonical) if [[ $# -lt 2 ]] then - echo "ERROR -- Parameter for --project is missing!" + echo "ERROR -- Parameter for --canonical is missing!" exit 1 fi CANONICAL="${2%%/}" @@ -127,7 +141,10 @@ fi echo "$JSON" | jq -C . -PROJECT=$(echo "$JSON" | jq -r '.artifactId') +if [[ -z "$PROJECT" ]] +then + PROJECT=$(echo "$JSON" | jq -r '.artifactId') +fi VERSION=$(echo "$JSON" | jq -r '.version') if [[ -n "$URL" ]] -- 2.39.5