Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
peel names its exit codes in its help and manual page
Țugui Dragoșf805db1f7e16
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/PeelCommand.swift b/Packages/PeelCore/Sources/PeelCommandLine/PeelCommand.swiftindex 09d12850..c218762b 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/PeelCommand.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/PeelCommand.swift@@ -6,7 +6,7 @@ public struct PeelCommand: AsyncParsableCommand {public static let configuration = CommandConfiguration(commandName: "peel",abstract: "Find what apps leave behind and move it to the Trash.",- discussion: "Peel only moves files to the Trash, so you can put them back. Items that need administrator access are left for the Peel app. The tool writes English whatever the Mac's language, since scripts read what it prints.",+ discussion: "Peel only moves files to the Trash, so you can put them back. Items that need administrator access are left for the Peel app. The tool writes English whatever the Mac's language, since scripts read what it prints. Exit status: 0 when it did what was asked, 1 when something failed or stayed where it was, 2 when you answered no, and 64 when the command or its options are wrong, or when Peel would have to ask and can't (add --yes).",version: Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "",subcommands: [AppsCommand.self,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swiftindex 0a868f7c..c63d3981 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift@@ -715,6 +715,18 @@ struct CommandLineTests {}}+ /// Scripts read the exit status, so the help and the manual page name each code, and each is the one the tool+ /// really uses: ArgumentParser's own for a usage error, and Peel's for a "no" and a failure.+ @Test func namesTheExitCodesItUses() {+ let help = PeelCommand.helpMessage(columns: 200)+ #expect(PeelCommand.exitCode(for: ValidationError("wrong")) == ExitCode(64))+ #expect(PeelCommand.exitCode(for: Output.declined) == ExitCode(2))+ #expect(PeelCommand.exitCode(for: ExitCode.failure) == ExitCode(1))+ for phrase in ["0 when it did what was asked", "1 when something failed", "2 when you answered no", "64 when the command"] {+ #expect(help.contains(phrase))+ }+ }+@Test func showsTheUsageOfTheSubcommandThatFailed() throws {let error = #expect(throws: (any Error).self) { try PeelCommand.parseAsRoot(["inventory", "--format", "bogus"]) }let message = PeelCommand.fullMessage(for: try #require(error), columns: 200)diff --git a/Support/peel.1 b/Support/peel.1index f22d90eb..493cb4dc 100644--- a/Support/peel.1+++ b/Support/peel.1@@ -11,7 +11,7 @@.Op Fl -version.Op Fl -help.Sh DESCRIPTION-Peel only moves files to the Trash, so you can put them back. Items that need administrator access are left for the Peel app. The tool writes English whatever the Mac's language, since scripts read what it prints.+Peel only moves files to the Trash, so you can put them back. Items that need administrator access are left for the Peel app. The tool writes English whatever the Mac's language, since scripts read what it prints. Exit status: 0 when it did what was asked, 1 when something failed or stayed where it was, 2 when you answered no, and 64 when the command or its options are wrong, or when Peel would have to ask and can't (add --yes)..Bl -tag -width 6n.It Fl -versionShow the version.