From e2a9c8de0be5783646ad8eeb75465c59961bf4e4 Mon Sep 17 00:00:00 2001 From: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com> Date: Fri, 23 Oct 2026 21:42:00 -0700 Subject: [PATCH] Reject unknown actions to background "removemacai background of" listed the background items and exited 0, so a typo for "off" went unnoticed. Fail with "unknown action" unless the action is off, on or missing. Fixes #82 Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com> --- Sources/removemacai/TweakCommands.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/removemacai/TweakCommands.swift b/Sources/removemacai/TweakCommands.swift index ca592bf..d87e674 100644 --- a/Sources/removemacai/TweakCommands.swift +++ b/Sources/removemacai/TweakCommands.swift @@ -136,9 +136,12 @@ enum TweakCommands { // MARK: background items static func background(_ args: [String], yes: Bool) -> Bool { + if let action = args.first, action != "off" && action != "on" { + Term.fail("unknown action \"\(action)\", use off or on") + } let items = BackgroundItems.scan() let labels = BackgroundItems.disabledLabels() - guard let action = args.first, action == "off" || action == "on" else { + guard let action = args.first else { Commands.header() if items.isEmpty { print("No background items from other apps.")