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.

Say which files peel search shows, and give it a discussion

Țugui Dragoș00907079d77c
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
index ad96eb8e..e8923b8e 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Commands/FileCommands.swift
@@ -954,7 +954,11 @@ struct DuplicatesCommand: AsyncParsableCommand {
}
struct SearchCommand: AsyncParsableCommand {
- static let configuration = CommandConfiguration(commandName: "search", abstract: "Search the Spotlight index for files.")
+ static let configuration = CommandConfiguration(
+ commandName: "search",
+ abstract: "Search the Spotlight index for files.",
+ discussion: "Peel asks Spotlight, so it finds only what Spotlight indexes, and network volumes aren't searched. It lists files alone, yours first, then those an app keeps in a Library folder, each largest first, at most \(Output.number(FileSearch.maximumResults)), and it says how many it left out and why."
+ )
@Option(help: "Part of the file name.")
var name: String?
@@ -1025,7 +1029,7 @@ struct SearchCommand: AsyncParsableCommand {
)
}
if results.isTruncated {
- Output.note("Only the first \(Output.number(FileSearch.maximumResults)) files are shown. Narrow the search to see the rest.")
+ Output.note("Only the first \(Output.number(FileSearch.maximumResults)) files are shown, yours before those an app keeps in a Library folder, each largest first. Narrow the search to see the rest.")
}
for reason in FileSearch.LeftOut.allCases {
if let count = results.leftOut[reason] { Output.note(Self.note(for: reason, count: count)) }
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
index f0e8d8a0..684c6847 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/CommandLineTests.swift
@@ -1296,6 +1296,18 @@ struct CommandLineTests {
let help = SearchCommand.helpMessage(columns: 300)
#expect(help.contains("Search every disk on this Mac, not only your home folder. Network volumes aren't searched."))
+ #expect(help.contains("yours first, then those an app keeps in a Library folder, each largest first"))
+ }
+
+ @Test func searchSaysWhichFilesItShowsWhenItCutsTheList() throws {
+ var results = FileSearchResults()
+ results.isTruncated = true
+ let search = try #require(try PeelCommand.parseAsRoot(["search", "--name", "report"]) as? SearchCommand)
+ let collected = Output.Collected()
+
+ try Output.$collected.withValue(collected) { try search.report(results) }
+
+ #expect(collected.notes == "Only the first 2000 files are shown, yours before those an app keeps in a Library folder, each largest first. Narrow the search to see the rest.\n")
}
@Test func searchSaysWhatItLeftOutAndWhy() throws {
diff --git a/Support/peel.1 b/Support/peel.1
index c1537ea8..506bb696 100644
--- a/Support/peel.1
+++ b/Support/peel.1
@@ -275,6 +275,8 @@ Show help information.
.El
.It Em search
Search the Spotlight index for files.
+.Pp
+Peel asks Spotlight, so it finds only what Spotlight indexes, and network volumes aren't searched. It lists files alone, yours first, then those an app keeps in a Library folder, each largest first, at most 2000, and it says how many it left out and why.
.Bl -tag -width 6n
.It Fl -name Ar name
Part of the file name.