diff --git a/bootstrap.sh b/bootstrap.sh index 848abdc..a8b0596 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +#=== HELP START === # run.sh – local wrapper for the “deb-changelog-action” # # Behaviour: @@ -32,6 +33,7 @@ # (configs/cliff.debian.toml) is used. # • PACKAGE_NAME, AUTHOR_NAME, AUTHOR_EMAIL are exported so the TOML template # can reference them (e.g. {{ get_env(name="PACKAGE_NAME") }}). +#=== HELP END === set -euo pipefail REPO_URL="https://git.0xmax42.io/actions/deb-changelog-action" @@ -46,7 +48,14 @@ OUTPUT_FILE="debian/changelog" CLIFF_CONFIG="" # ─────────────────────────────────────────────── -show_help() { sed -n '2,34p' "$0"; } +show_help() { + sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ { + /^#=== HELP START ===/d + /^#=== HELP END ===/d + s/^#// + p + }' "$0" +} # 1 ─ Parse CLI options ───────────────────────── while [[ $# -gt 0 ]]; do diff --git a/scripts/generate-changelog.sh b/scripts/generate-changelog.sh index 5ba3794..defbc62 100755 --- a/scripts/generate-changelog.sh +++ b/scripts/generate-changelog.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +#=== HELP START === # generate-changelog.sh – generates a Debian-style changelog via git-cliff # # Usage: @@ -16,6 +17,7 @@ # • Checks that the config file exists and is readable. # • Ensures the parent directory of the output file exists (unless --debug). # • Generates the changelog; removes a leading empty line. +#=== HELP END === set -euo pipefail # ─────────────────────────────────────────────── @@ -25,7 +27,14 @@ OUT_FILE="" DEBUG=false # ─────────────────────────────────────────────── -show_help() { sed -n '2,18p' "$0"; } +show_help() { + sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ { + /^#=== HELP START ===/d + /^#=== HELP END ===/d + s/^#// + p + }' "$0" +} # 1 Parse CLI options while [[ $# -gt 0 ]]; do diff --git a/scripts/install-git-cliff.sh b/scripts/install-git-cliff.sh index 323043f..bb640b7 100755 --- a/scripts/install-git-cliff.sh +++ b/scripts/install-git-cliff.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +#=== HELP START === # install-git-cliff.sh – Installs the git-cliff binary # Usage: @@ -22,6 +23,7 @@ # aarch64-linux-gnu / musl / apple-darwin / pc-windows-msvc # i686-linux-gnu / musl / pc-windows-msvc # x86_64-linux-gnu / musl / apple-darwin / pc-windows-* +#=== HELP END === set -euo pipefail REPO="orhun/git-cliff" @@ -39,7 +41,14 @@ USER_VERSION_SPECIFIED=false # ─────────────────────────────────────────────── # 0 Help function -show_help() { sed -n '2,24p' "$0"; } +show_help() { + sed -n '/^#=== HELP START ===/,/^#=== HELP END ===/ { + /^#=== HELP START ===/d + /^#=== HELP END ===/d + s/^#// + p + }' "$0" +} # 1 Parse options (keeps old single-arg form) POSITIONAL=()