chore: add 'set -e' to every nomarchy-* bash script that lacks it

Sweep across the three script directories: features/scripts/utils,
core/system/scripts, themes/engine/scripts. 142 of 169 bash scripts
gained `set -e`; 27 already had it; the one Python helper
(nomarchy-haptic-touchpad) was skipped via shebang detection.

Why: bash's default behavior is to continue past a failed command,
which means a script that does "do A; do B; do C" leaves the system
in a half-applied state when B fails - and the user gets no signal.
Several recent fix commits (theme partial-apply, waybar reload race,
installer prewipe silent failures) all trace back to this. set -e
turns silent corruption into a loud abort the user can act on.

The 11 scripts with explicit `|| true` markers stay safe under set -e
because || true coerces the exit to zero; the markers continue to
mean "I deliberately tolerate this failure here."

Deliberate exception: nomarchy-menu runs WITHOUT set -e. It is an
interactive UX loop where action branches do `cmd; back_to <self>`
so a failed action would abort the script under set -e and the menu
would disappear without feedback. Soft-failure - menu re-displays,
user picks again - is the right semantic. Documented inline.

Validation: bash -n on every modified script (zero failures). The
new pre-commit hook (27f5663) was just updated to filter by shebang
so it doesn't try to bash-syntax-check the Python helper - that
filter was uncovered by this sweep.

Risk: set -e can surface latent bugs in scripts that previously
relied on silent continuation. If anything breaks, it's a real bug
that was already broken and is now visible. Easy per-script revert
if any UX glitches show up.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-04-30 20:50:13 +01:00
parent 27f5663cdf
commit 1e9481849b
143 changed files with 148 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Returns the name of the current monospace font being used by extracting it from the Waybar stylesheet.
# This can be changed using nomarchy-font-set.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Returns a list of all the monospace fonts available on the system that can be set using nomarchy-font-set.

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Set the system-wide monospace font that should be used by the terminal, hyprlock, waybar, swayosd, etc.
# Declarative version for Nomarchy NixOS.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Display a "Done!" message with a spinner and wait for user to press any key.
# Used by various install scripts to indicate completion.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Display the Nomarchy logo in the terminal using green color.
# Used by various presentation scripts to show branding.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
CURRENT_THEME_NAME=$(cat "$HOME/.config/nomarchy/current/theme.name")
THEME_USER_BACKGROUNDS="$HOME/.config/nomarchy/backgrounds/$CURRENT_THEME_NAME"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Cycles through the background images available for the current theme.
# Declarative + Hybrid (instant swww) for Nomarchy NixOS.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Sets the specified image as the current background

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
THEME_NAME_PATH="$HOME/.config/nomarchy/current/theme.name"

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# nomarchy-theme-install: Install a new theme from a git repo for Nomarchy
# Usage: nomarchy-theme-install <git-repo-url>

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
{
find ~/.config/nomarchy/themes/ -mindepth 1 -maxdepth 1 \( -type d -o -type l \) -printf '%f\n'

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Refresh the current theme from its templates.

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# nomarchy-theme-remove: Remove a theme from Nomarchy by name
# Usage: nomarchy-theme-remove <theme-name>

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Set the system theme declaratively.
# Usage: nomarchy-theme-set <theme-name>

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
nomarchy-theme-set-keyboard-asus-rog
nomarchy-theme-set-keyboard-f16

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
ASUSCTL_THEME=~/.config/nomarchy/current/theme/keyboard.rgb

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
FRAMEWORK16_THEME=~/.config/nomarchy/current/theme/keyboard.rgb

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
# Sync Nomarchy theme to all Obsidian vaults

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
TEMPLATES_DIR="$NOMARCHY_PATH/themes/templates"
USER_TEMPLATES_DIR="$HOME/.config/nomarchy/themes/templates"

View File

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
for dir in ~/.config/nomarchy/themes/*/; do
if [[ -d $dir ]] && [[ ! -L ${dir%/} ]] && [[ -d $dir/.git ]]; then

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -e
# Toggles the nightlight (hyprsunset).
# Hybrid: updates state.json and provides instant feedback.