From 15bfbc5d613e5ed154c65a7821d8c6b42e2b5141 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 22 Apr 2025 20:58:31 +0500 Subject: [PATCH] chore: format scripts --- release.sh | 60 +++++++++++++++++++++++------------------------ update_version.sh | 40 +++++++++++++++---------------- 2 files changed, 50 insertions(+), 50 deletions(-) diff --git a/release.sh b/release.sh index 167fc1cd..b9163918 100755 --- a/release.sh +++ b/release.sh @@ -2,7 +2,7 @@ set -euo pipefail usage() { - cat < ] Create annotated git tags for module releases. @@ -28,7 +28,7 @@ EOF check_getopt() { # Check if we have GNU or BSD getopt. - if getopt --test >/dev/null 2>&1; then + if getopt --test > /dev/null 2>&1; then # Exit status 4 means GNU getopt is available. if [[ $? -ne 4 ]]; then echo "Error: GNU getopt is not available." >&2 @@ -50,10 +50,10 @@ maybe_dry_run() { } get_readme_version() { - grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" | - head -1 | - grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' || - echo "0.0.0" + grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" \ + | head -1 \ + | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' \ + || echo "0.0.0" } list_modules() { @@ -131,29 +131,29 @@ eval set -- "$temp" while true; do case "$1" in - -l | --list) - list=true - shift - ;; - -d | --dry-run) - dry_run=true - shift - ;; - -p | --push) - push=true - shift - ;; - -h | --help) - usage - ;; - --) - shift - break - ;; - *) - echo "Error: Internal error!" >&2 - exit 1 - ;; + -l | --list) + list=true + shift + ;; + -d | --dry-run) + dry_run=true + shift + ;; + -p | --push) + push=true + shift + ;; + -h | --help) + usage + ;; + --) + shift + break + ;; + *) + echo "Error: Internal error!" >&2 + exit 1 + ;; esac done @@ -178,7 +178,7 @@ if ! tag_name=$(get_tag_name "$module" "$version"); then exit 1 fi -if git rev-parse -q --verify "refs/tags/$tag_name" >/dev/null 2>&1; then +if git rev-parse -q --verify "refs/tags/$tag_name" > /dev/null 2>&1; then echo "Notice: Tag '$tag_name' already exists" >&2 else maybe_dry_run git tag -a "$tag_name" -m "Release $module v$version" diff --git a/update_version.sh b/update_version.sh index 1f85a907..39430cdd 100755 --- a/update_version.sh +++ b/update_version.sh @@ -2,7 +2,7 @@ set -euo pipefail usage() { - cat < Update or check the version in a module's README.md file. @@ -63,14 +63,14 @@ update_version() { print } - ' "$file" >"$tmpfile" && mv "$tmpfile" "$file" + ' "$file" > "$tmpfile" && mv "$tmpfile" "$file" } get_readme_version() { - grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" | - head -1 | - grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' || - echo "0.0.0" + grep -o 'version *= *"[0-9]\+\.[0-9]\+\.[0-9]\+"' "$1" \ + | head -1 \ + | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+' \ + || echo "0.0.0" } # Set defaults. @@ -79,20 +79,20 @@ check_only=false # Parse command-line options. while [[ $# -gt 0 ]]; do case "$1" in - -c | --check) - check_only=true - shift - ;; - -h | --help) - usage 0 - ;; - -*) - echo "Error: Unknown option: $1" >&2 - usage 1 - ;; - *) - break - ;; + -c | --check) + check_only=true + shift + ;; + -h | --help) + usage 0 + ;; + -*) + echo "Error: Unknown option: $1" >&2 + usage 1 + ;; + *) + break + ;; esac done