Fix style inconsistencies in bin/ (#7518)

* Use (( )) for the numeric argument test

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop the quotes on a variable inside [[ ]]

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Use omarchy-pkg-drop instead of raw pacman -Rns

omarchy-pkg-drop already filters to installed packages, so the
2>/dev/null || true suppression is no longer needed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Drop defensive checks around default-set commands

ttfx, imagemagick, and networkmanager are all in the default package
set, so their commands are runtime invariants and should be invoked
directly. Removing the nmcli guard also removes the degraded wifi
fallthrough that only ran when nmcli was missing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-19 20:16:47 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 3451719ca5
commit 9455496990
6 changed files with 12 additions and 26 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ flags=()
only=() only=()
declare -A excluded declare -A excluded
while [[ $# -gt 0 ]]; do while (( $# > 0 )); do
case "$1" in case "$1" in
--force | --limits-only) flags+=("$1") ;; --force | --limits-only) flags+=("$1") ;;
--except) --except)
+1 -1
View File
@@ -116,7 +116,7 @@ main() {
local length payload url local length payload url
# Detached worker: this is what actually runs yt-dlp and fires notifications. # Detached worker: this is what actually runs yt-dlp and fires notifications.
if [[ "${1:-}" == "--download" ]]; then if [[ ${1:-} == "--download" ]]; then
download_url "$2" download_url "$2"
fi fi
-4
View File
@@ -2,10 +2,6 @@
# omarchy:summary=Launch the Omarchy screensaver in the default terminal on the system with the correct font configuration. # omarchy:summary=Launch the Omarchy screensaver in the default terminal on the system with the correct font configuration.
if omarchy-cmd-missing ttfx; then
exit 1
fi
# Exit early if screensaver is already running # Exit early if screensaver is already running
pgrep -f '[o]rg.omarchy.screensaver' && exit 0 pgrep -f '[o]rg.omarchy.screensaver' && exit 0
+8 -13
View File
@@ -34,23 +34,18 @@ print_status() {
return return
fi fi
if omarchy-cmd-present nmcli; then nm=$(nmcli -t -f GENERAL.STATE,GENERAL.CONNECTION dev show "$device" 2>/dev/null)
nm=$(nmcli -t -f GENERAL.STATE,GENERAL.CONNECTION dev show "$device" 2>/dev/null) state=$(awk -F: '$1 == "GENERAL.STATE" { print $2; exit }' <<<"$nm")
state=$(awk -F: '$1 == "GENERAL.STATE" { print $2; exit }' <<<"$nm") ssid=$(awk -F: '$1 == "GENERAL.CONNECTION" { print $2; exit }' <<<"$nm")
ssid=$(awk -F: '$1 == "GENERAL.CONNECTION" { print $2; exit }' <<<"$nm") signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" --rescan no 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }')
signal=$(nmcli -t -f IN-USE,SIGNAL dev wifi list ifname "$device" --rescan no 2>/dev/null | awk -F: '$1 == "*" { print $2; exit }') freq=$(iw dev "$device" link 2>/dev/null | awk '/freq:/ { print $2; exit }')
freq=$(iw dev "$device" link 2>/dev/null | awk '/freq:/ { print $2; exit }')
if [[ $state != 100* ]]; then if [[ $state != 100* ]]; then
printf 'disconnected\t\t\t\n' printf 'disconnected\t\t\t\n'
return
fi
printf 'wifi\t%s\t%s\t%s\n' "${ssid:-$device}" "$signal" "$freq"
return return
fi fi
printf 'wifi\t%s\t\t\n' "$device" printf 'wifi\t%s\t%s\t%s\n' "${ssid:-$device}" "$signal" "$freq"
} }
ping_latency_ms() { ping_latency_ms() {
+2 -2
View File
@@ -10,7 +10,7 @@ if [[ -z $1 ]]; then
fi fi
remove_php() { remove_php() {
sudo pacman -Rns --noconfirm php composer php-sqlite xdebug 2>/dev/null || true omarchy-pkg-drop php composer php-sqlite xdebug
} }
case "$1" in case "$1" in
@@ -50,7 +50,7 @@ laravel)
;; ;;
symfony) symfony)
echo -e "Removing Symfony CLI...\n" echo -e "Removing Symfony CLI...\n"
sudo pacman -Rns --noconfirm symfony-cli 2>/dev/null || true omarchy-pkg-drop symfony-cli
;; ;;
python) python)
echo -e "Removing Python...\n" echo -e "Removing Python...\n"
-5
View File
@@ -101,11 +101,6 @@ if [[ ! -f $image_path ]]; then
exit 1 exit 1
fi fi
if omarchy-cmd-missing magick; then
echo "ImageMagick is required to convert logo images" >&2
exit 1
fi
if [[ $mode == "braille" ]]; then if [[ $mode == "braille" ]]; then
pixel_width=$((width * 2)) pixel_width=$((width * 2))
pixel_height=$((height * 4)) pixel_height=$((height * 4))