refactor(help): improve help extraction for scripts
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
All checks were successful
Auto Changelog & Release / release (push) Successful in 8s
- Standardize help section delimiters across scripts - Update `show_help` functions to extract help text dynamically - Enhance maintainability and readability of help-related code
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user