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 ===
|
||||
# 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=()
|
||||
|
Reference in New Issue
Block a user