Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Drop a check peel projects can never reach

Țugui Dragoș5b3ae7234c0d
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index bf174130..ef50b0fe 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -404,7 +404,7 @@ struct ProjectsCommand: AsyncParsableCommand {
ProjectArtifacts.refusal(for: root).map { "\(Output.plain(Output.path(root))): \($0.summary)" }
}
guard refused.count < folders.count else {
- throw ValidationError((refused.isEmpty ? ["No folders to look in."] : refused).joined(separator: "\n"))
+ throw ValidationError(refused.joined(separator: "\n"))
}
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index a96aa2e8..96dc023d 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -1052,4 +1052,15 @@ struct CommandLineTests {
#expect(throws: (any Error).self) { try PeelCommand.parseAsRoot(["history", "--clear"]) }
#expect(throws: (any Error).self) { try PeelCommand.parseAsRoot(["history", "--refused", "--limit", "0"]) }
}
+
+ @Test func projectsCannotRunWithoutAFolder() {
+ for arguments in [["projects"], ["projects", "--json"]] {
+ do {
+ _ = try PeelCommand.parseAsRoot(arguments)
+ Issue.record("parsed without a folder")
+ } catch {
+ #expect(PeelCommand.message(for: error).contains("Missing expected argument"))
+ }
+ }
+ }
}