mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-05-28 18:43:40 +00:00
chore(style): normalize indentation and line continuations in shell scripts
Apply consistent 4-space indentation and trailing-operator style for line continuations (&&, |) across all development and release scripts. No logic changes. Release-Notes: skip
This commit is contained in:
parent
a93ad1ac96
commit
e163a47d57
9 changed files with 110 additions and 112 deletions
|
|
@ -51,15 +51,15 @@ if grep -q '^\[alias\]' ~/.gitconfig.host; then
|
|||
|
||||
# First, collect all aliases from host config
|
||||
TEMP_ALIASES=$(mktemp)
|
||||
sed -n '/^\[alias\]/,/^\[/p' ~/.gitconfig.host | \
|
||||
grep -v '^\[' | \
|
||||
grep -v '^$' | \
|
||||
sed -n '/^\[alias\]/,/^\[/p' ~/.gitconfig.host |
|
||||
grep -v '^\[' |
|
||||
grep -v '^$' |
|
||||
while IFS= read -r line; do
|
||||
# Skip aliases with macOS-specific paths
|
||||
if echo "$line" | grep -q -E '/(Applications|usr/local)'; then
|
||||
continue
|
||||
fi
|
||||
echo "$line" >> "$TEMP_ALIASES"
|
||||
echo "$line" >>"$TEMP_ALIASES"
|
||||
done
|
||||
|
||||
# Apply each alias (git config --global overwrites existing values = idempotent)
|
||||
|
|
@ -68,8 +68,8 @@ if grep -q '^\[alias\]' ~/.gitconfig.host; then
|
|||
ALIAS_NAME=$(echo "$line" | awk '{print $1}')
|
||||
ALIAS_VALUE=$(echo "$line" | sed "s/^$ALIAS_NAME = //")
|
||||
git config --global "alias.$ALIAS_NAME" "$ALIAS_VALUE" 2>/dev/null || true
|
||||
done < "$TEMP_ALIASES"
|
||||
echo " Synced $(wc -l < "$TEMP_ALIASES") aliases"
|
||||
done <"$TEMP_ALIASES"
|
||||
echo " Synced $(wc -l <"$TEMP_ALIASES") aliases"
|
||||
fi
|
||||
|
||||
rm -f "$TEMP_ALIASES"
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ build_diff_context() {
|
|||
if ! diff_context=$(
|
||||
set -o pipefail
|
||||
git diff --unified=0 --no-color --minimal --patience --diff-filter=AM \
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null \
|
||||
| awk '
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null |
|
||||
awk '
|
||||
/^diff --git / { print; next }
|
||||
/^--- / || /^\+\+\+ / || /^@@ / { print; next }
|
||||
/^[+-]/ {
|
||||
|
|
@ -177,18 +177,18 @@ build_diff_context() {
|
|||
print
|
||||
next
|
||||
}
|
||||
' \
|
||||
| head -c "$RELEASE_NOTES_DIFF_MAX_BYTES"
|
||||
' |
|
||||
head -c "$RELEASE_NOTES_DIFF_MAX_BYTES"
|
||||
); then
|
||||
log_info "${YELLOW}Warning: compact diff generation failed, falling back to legacy diff context${NC}"
|
||||
diff_context=$(git diff --unified=2 --diff-filter=AM \
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null \
|
||||
| head -c "$RELEASE_NOTES_DIFF_MAX_BYTES" || true)
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null |
|
||||
head -c "$RELEASE_NOTES_DIFF_MAX_BYTES" || true)
|
||||
fi
|
||||
else
|
||||
diff_context=$(git diff --unified=2 --diff-filter=AM \
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null \
|
||||
| head -c "$RELEASE_NOTES_DIFF_MAX_BYTES" || true)
|
||||
"${FROM_TAG}..${TO_TAG}" -- "${USER_FACING_PATHS[@]}" 2>/dev/null |
|
||||
head -c "$RELEASE_NOTES_DIFF_MAX_BYTES" || true)
|
||||
fi
|
||||
|
||||
echo "$diff_context"
|
||||
|
|
@ -264,8 +264,8 @@ generate_with_copilot() {
|
|||
FINAL_FILE_CHANGES=$(git diff --name-status "${FROM_TAG}..${TO_TAG}" 2>/dev/null || true)
|
||||
|
||||
# Revert commits are useful chronology hints (earlier changes may be superseded).
|
||||
REVERT_COMMITS=$(git log --reverse --pretty=format:"%h | %s" "${FROM_TAG}..${TO_TAG}" \
|
||||
| grep -Ei '\|[[:space:]]*revert\b' || true)
|
||||
REVERT_COMMITS=$(git log --reverse --pretty=format:"%h | %s" "${FROM_TAG}..${TO_TAG}" |
|
||||
grep -Ei '\|[[:space:]]*revert\b' || true)
|
||||
|
||||
if [[ -z $FINAL_FILE_CHANGES ]]; then
|
||||
FINAL_FILE_CHANGES="(none)"
|
||||
|
|
@ -442,7 +442,7 @@ End after the Buy Me A Coffee button. No meta-commentary, no explanations."
|
|||
|
||||
# Save prompt to temp file for copilot
|
||||
TEMP_PROMPT=$(mktemp)
|
||||
echo "$PROMPT" > "$TEMP_PROMPT"
|
||||
echo "$PROMPT" >"$TEMP_PROMPT"
|
||||
|
||||
# Use Claude Sonnet for better user-focused, plain-language release notes.
|
||||
# Haiku tends to echo technical commit language; Sonnet better translates to user benefits.
|
||||
|
|
@ -450,7 +450,7 @@ End after the Buy Me A Coffee button. No meta-commentary, no explanations."
|
|||
COPILOT_MODEL="${COPILOT_MODEL:-claude-sonnet-4.6}"
|
||||
|
||||
# Call copilot CLI (it will handle authentication interactively)
|
||||
copilot --model "$COPILOT_MODEL" < "$TEMP_PROMPT" || {
|
||||
copilot --model "$COPILOT_MODEL" <"$TEMP_PROMPT" || {
|
||||
echo ""
|
||||
log_info "${YELLOW}Warning: GitHub Copilot CLI failed or was not authenticated${NC}"
|
||||
log_info "${YELLOW}Falling back to git-cliff${NC}"
|
||||
|
|
@ -501,7 +501,7 @@ generate_with_gitcliff() {
|
|||
|
||||
# Create temporary cliff.toml if not exists
|
||||
if [ ! -f "cliff.toml" ]; then
|
||||
cat > /tmp/cliff.toml <<'EOF'
|
||||
cat >/tmp/cliff.toml <<'EOF'
|
||||
[changelog]
|
||||
header = ""
|
||||
body = """
|
||||
|
|
@ -723,21 +723,19 @@ generate_with_manual() {
|
|||
# Append to appropriate file
|
||||
case "$TYPE" in
|
||||
whats_new)
|
||||
echo "$LINE" >> "$WHATS_NEW_FILE"
|
||||
echo "$LINE" >>"$WHATS_NEW_FILE"
|
||||
;;
|
||||
fixed)
|
||||
echo "$LINE" >> "$FIXED_FILE"
|
||||
echo "$LINE" >>"$FIXED_FILE"
|
||||
;;
|
||||
reliable)
|
||||
echo "$LINE" >> "$RELIABLE_FILE"
|
||||
echo "$LINE" >>"$RELIABLE_FILE"
|
||||
;;
|
||||
deps)
|
||||
echo "$LINE" >> "$DEPS_FILE"
|
||||
;;
|
||||
skip)
|
||||
;;
|
||||
*)
|
||||
echo "$LINE" >>"$DEPS_FILE"
|
||||
;;
|
||||
skip) ;;
|
||||
*) ;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
|
@ -797,7 +795,7 @@ fi
|
|||
|
||||
# Validate backend availability
|
||||
case "$BACKEND" in
|
||||
copilot)
|
||||
copilot)
|
||||
if ! command -v copilot >/dev/null 2>&1; then
|
||||
echo -e "${RED}Error: GitHub Copilot CLI not found${NC}" >&2
|
||||
echo "Install: npm install -g @github/copilot" >&2
|
||||
|
|
@ -805,7 +803,7 @@ case "$BACKEND" in
|
|||
exit 1
|
||||
fi
|
||||
;;
|
||||
git-cliff)
|
||||
git-cliff)
|
||||
if ! command -v git-cliff >/dev/null 2>&1; then
|
||||
echo -e "${RED}Error: git-cliff not found${NC}" >&2
|
||||
echo "Install: https://git-cliff.org/docs/installation" >&2
|
||||
|
|
@ -819,13 +817,13 @@ if [ "$AUTO_UPDATE_AVAILABLE" = "true" ]; then
|
|||
TEMP_NOTES=$(mktemp)
|
||||
case "$BACKEND" in
|
||||
copilot)
|
||||
generate_with_copilot > "$TEMP_NOTES"
|
||||
generate_with_copilot >"$TEMP_NOTES"
|
||||
;;
|
||||
git-cliff)
|
||||
generate_with_gitcliff > "$TEMP_NOTES"
|
||||
generate_with_gitcliff >"$TEMP_NOTES"
|
||||
;;
|
||||
manual)
|
||||
generate_with_manual > "$TEMP_NOTES"
|
||||
generate_with_manual >"$TEMP_NOTES"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
|
|
@ -903,7 +901,7 @@ fi
|
|||
|
||||
# Save body (without H1 title) to temp file for GitHub
|
||||
TEMP_BODY=$(mktemp)
|
||||
echo "$NOTES_BODY" > "$TEMP_BODY"
|
||||
echo "$NOTES_BODY" >"$TEMP_BODY"
|
||||
|
||||
# Show the generated notes (with title for preview)
|
||||
if [ -n "$EXTRACTED_TITLE" ]; then
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ fi
|
|||
|
||||
# Check 2: manifest.json syntax
|
||||
printf "%b Checking manifest.json syntax...%b\n" "$BOLD" "$NC"
|
||||
if ! python -m json.tool "$INTEGRATION_PATH/manifest.json" > /dev/null 2>&1; then
|
||||
if ! python -m json.tool "$INTEGRATION_PATH/manifest.json" >/dev/null 2>&1; then
|
||||
log_result 1 "manifest.json has invalid JSON syntax"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
else
|
||||
|
|
@ -49,7 +49,7 @@ printf "%b Checking translation files syntax...%b\n" "$BOLD" "$NC"
|
|||
for lang_file in "$INTEGRATION_PATH"/translations/*.json; do
|
||||
if [[ -f $lang_file ]]; then
|
||||
lang=$(basename "$lang_file")
|
||||
if ! python -m json.tool "$lang_file" > /dev/null 2>&1; then
|
||||
if ! python -m json.tool "$lang_file" >/dev/null 2>&1; then
|
||||
log_result 1 "$lang has invalid JSON syntax"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
else
|
||||
|
|
@ -64,7 +64,7 @@ if [[ -d $INTEGRATION_PATH/custom_translations ]]; then
|
|||
for lang_file in "$INTEGRATION_PATH"/custom_translations/*.json; do
|
||||
if [[ -f $lang_file ]]; then
|
||||
lang=$(basename "$lang_file")
|
||||
if ! python -m json.tool "$lang_file" > /dev/null 2>&1; then
|
||||
if ! python -m json.tool "$lang_file" >/dev/null 2>&1; then
|
||||
log_result 1 "custom_translations/$lang has invalid JSON syntax"
|
||||
ERRORS=$((ERRORS + 1))
|
||||
else
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ require_command "jq" "apt-get install jq (or brew install jq)"
|
|||
cp "$MANIFEST" "$MANIFEST.backup"
|
||||
|
||||
# Update version with jq
|
||||
if ! jq ".version = \"$VERSION\"" "$MANIFEST" > "$MANIFEST.tmp"; then
|
||||
if ! jq ".version = \"$VERSION\"" "$MANIFEST" >"$MANIFEST.tmp"; then
|
||||
mv "$MANIFEST.backup" "$MANIFEST"
|
||||
die "Failed to update manifest.json"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ parse_version() {
|
|||
}
|
||||
|
||||
CURRENT_VERSION="${FROM_TAG#v}"
|
||||
read -r MAJOR MINOR PATCH PRERELEASE <<< "$(parse_version "$CURRENT_VERSION")"
|
||||
read -r MAJOR MINOR PATCH PRERELEASE <<<"$(parse_version "$CURRENT_VERSION")"
|
||||
|
||||
printf "Current released version: %bv%s.%s.%s%s%b\n" "$BOLD" "$MAJOR" "$MINOR" "$PATCH" "$PRERELEASE" "$NC"
|
||||
if [[ $MANIFEST_VERSION != "$CURRENT_VERSION" ]]; then
|
||||
|
|
|
|||
|
|
@ -101,11 +101,11 @@ pre-commit install
|
|||
|
||||
log_header "Updating shell environment"
|
||||
if ! grep -q "source $HOME/.venv/bin/activate" "$HOME/.bashrc" 2>/dev/null; then
|
||||
echo "source $HOME/.venv/bin/activate" >> "$HOME/.bashrc"
|
||||
echo "source $HOME/.venv/bin/activate" >>"$HOME/.bashrc"
|
||||
fi
|
||||
if [[ -f $HOME/.zshrc ]]; then
|
||||
if ! grep -q "source $HOME/.venv/bin/activate" "$HOME/.zshrc"; then
|
||||
echo "source $HOME/.venv/bin/activate" >> "$HOME/.zshrc"
|
||||
echo "source $HOME/.venv/bin/activate" >>"$HOME/.zshrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ ensure_command_alias "rg" "ripgrep"
|
|||
|
||||
# Ensure user-local bin directory is available in interactive shells.
|
||||
if ! grep -q '\$HOME/.local/bin' "$HOME/.zshrc" 2>/dev/null; then
|
||||
printf '\n# Added by scripts/setup/setup\nexport PATH="$HOME/.local/bin:$PATH"\n' >> "$HOME/.zshrc"
|
||||
printf '\n# Added by scripts/setup/setup\nexport PATH="$HOME/.local/bin:$PATH"\n' >>"$HOME/.zshrc"
|
||||
fi
|
||||
|
||||
# Install HACS for testing with other custom components
|
||||
|
|
@ -104,8 +104,8 @@ fi
|
|||
# Download and extract HACS (stable release ZIP)
|
||||
cd config/custom_components
|
||||
log_step "Downloading HACS"
|
||||
if wget -q https://github.com/hacs/integration/releases/latest/download/hacs.zip && \
|
||||
unzip -q hacs.zip -d hacs && \
|
||||
if wget -q https://github.com/hacs/integration/releases/latest/download/hacs.zip &&
|
||||
unzip -q hacs.zip -d hacs &&
|
||||
rm hacs.zip; then
|
||||
cd ../..
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue