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.

Name the folders peel projects couldn't search from the scan itself

Țugui Dragoș32ee575941c2
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index 676dbcdb..70b13509 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -413,12 +413,6 @@ struct ProjectsCommand: AsyncParsableCommand {
func run() async throws {
let roots = folders.map(URL.init(argument:))
- // Each folder that can't be searched gets a note, so it isn't mistaken for one with nothing built in it.
- for root in roots {
- if let refusal = ProjectArtifacts.refusal(for: root) {
- Output.note("\(Output.plain(Output.path(root))): \(refusal.summary)")
- }
- }
let exclusions = await UnreadableExclusions.load()
let scan = await ProgressLine.counting { await ProjectArtifacts.scan(roots: roots, exclusions: exclusions) }
let artifacts = scan.artifacts
@@ -446,7 +440,7 @@ struct ProjectsCommand: AsyncParsableCommand {
/// What the scan couldn't look at, said on standard error whatever the output, so that an empty answer is not
/// read as nothing being there.
static func notes(for scan: ProjectArtifacts.Scan) -> [String] {
- var notes: [String] = []
+ var notes = scan.refusedRoots.map { "\(Output.path($0.url)): \($0.reason.summary)" }
if !scan.unreadableLocations.isEmpty {
notes.append(
Output.unreadableNote(for: scan.unreadableLocations, needsFullDiskAccess: scan.needsFullDiskAccess)
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
index b8f88599..3ef9a5f1 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/FileCommandTests.swift
@@ -601,6 +601,13 @@ struct FileCommandTests {
#expect(report["unreadableLocations"] as? [String] == ["/Users/me/Library/Safari"])
}
+ @Test func namesEachChosenFolderTheScanDidNotSearch() {
+ let unplugged = URL(filePath: "/Volumes/Disk/Projects", directoryHint: .isDirectory)
+ let scan = ProjectArtifacts.Scan(refusedRoots: [(unplugged, .notAFolder)])
+
+ #expect(ProjectsCommand.notes(for: scan) == ["/Volumes/Disk/Projects: it isn't a folder Peel can reach"])
+ }
+
/// `peel caches --json` says which folders `--remove` would take.
@Test func theCachesListSaysWhatRemoveWouldTake() throws {
let directory = try TemporaryDirectory()