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.

Let Select All take what Peel holds back, after asking

Țugui Dragoș41a217924f10
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9e162279..7e5927e7 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -171,8 +171,9 @@ Tests enforce these. If your change makes one of them fail, the rule is right an
Anything shared is shown and left unselected, and nothing is selected for an app that would stay.
- **What may exist nowhere else is never selected for the user.** A folder with a wallet, a signing key, a password
database, or a repository inside, one where an app keeps what may exist only on this Mac, or one Peel could not
- finish reading, is shown with its reason and moves only when the user selects it with its own click: Select All,
- `peel uninstall`, `peel orphans --remove`, and `peel projects --remove` pass it by (`SelectableRows.leftToTheClick`).
+ finish reading, is shown with its reason and moves only when the user selects it: `peel uninstall`, `peel orphans
+ --remove`, and `peel projects --remove` pass it by, and Select All takes it only once the user has answered the
+ question that counts what Peel doesn't recommend (`SelectableRows.notRecommendedAdded`).
A repository can still be selected in two places, since its tool clones it again: inside a folder the tool tags as a
cache (`CACHEDIR.TAG`), such as Swift Package Manager's `.build`, and inside a cache on the Developer page, such as
the packages Xcode checks out into DerivedData.
diff --git a/GUIDE.md b/GUIDE.md
index 47558c66..f5a53771 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -20,10 +20,9 @@ and how to get it, [SAFETY.md](SAFETY.md) what it protects, [PRIVACY.md](PRIVACY
on this Mac: local mail, message history, sign-in codes, or VPN connections. A file another installed app also
uses is shown but never selected, and what Peel only guesses at, from the start of a name or an identifier the
app's maker or signing team also uses, waits under Review Before Removing. A list's Select menu has Select
- Recommended, Select All, and Deselect All. Select All passes by what Peel holds back for what it may hold, what
- it only guesses at, and what another app or another copy of the app also uses, which you select one by one, and
- asks before it adds anything else Peel doesn't recommend. The folder Homebrew keeps for an app it installed is
- selected too, so that Homebrew stops listing the app once it is gone.
+ Recommended, Select All, and Deselect All. Select All selects everything you can select, what Peel holds back
+ included, and asks first when that takes anything Peel doesn't recommend. The folder Homebrew keeps for an app
+ it installed is selected too, so that Homebrew stops listing the app once it is gone.
- **Several ways in.** Choose an app in the list, drop one on Peel's Dock icon, select several apps at once, or
Control-click an app in Finder and choose Uninstall with Peel, once the Finder extension is on in System
Settings. With Watch the Trash on, Peel notices when you drag an app to the Trash yourself and offers to clear
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index af3310bd..3807ae68 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -72,13 +72,6 @@ public struct DeveloperEnvironment: Sendable, Hashable, Identifiable {
public var id: URL { url }
- /// True when Select All passes the location by: its size is not known, nothing shows the tool made it, a
- /// workspace may still be in use, something inside may exist nowhere else, or it holds the archives of the
- /// apps the person built.
- public var isLeftToTheClick: Bool {
- size == nil || !isTheTools || workspace?.mayStillBeInUse == true || heldBack != nil || kind == .archives
- }
-
/// Whether Peel recommends this location, which Select Recommended selects and `peel caches --remove` moves:
/// only content that tools make or fetch again, or logs, and only once measured.
public var isRecommended: Bool {
@@ -105,8 +98,7 @@ public struct DeveloperEnvironment: Sendable, Hashable, Identifiable {
SelectableRows(
rows: locations.map(\.url),
selectable: locations.map(\.url),
- recommended: locations.filter(\.isRecommended).map(\.url),
- leftToTheClick: locations.filter(\.isLeftToTheClick).map(\.url)
+ recommended: locations.filter(\.isRecommended).map(\.url)
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
index f5e79bc9..04d05917 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/ProjectArtifacts.swift
@@ -35,9 +35,7 @@ public struct ProjectArtifact: Sendable, Hashable, Identifiable {
extension Collection where Element == ProjectArtifact {
public var selectableRows: SelectableRows<URL> {
SelectableRows(
- rows: map(\.url), selectable: map(\.url), recommended: filter(\.isRecommended).map(\.url),
- leftToTheClick: filter { $0.heldBack?.isLeftToTheClick == true || $0.hasGenericName || $0.isEnvironment }
- .map(\.url)
+ rows: map(\.url), selectable: map(\.url), recommended: filter(\.isRecommended).map(\.url)
)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index 50e9b61a..0b088b52 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -110,21 +110,6 @@ public enum HoldBack: String, Sendable, Hashable {
|| self == .holdsAnExclusion
}
- /// True when Select All passes the item by, leaving it to a click: every reason does, as each says the item may
- /// hold what exists nowhere else, belongs to something else, or is not known, except a crash report, which Peel
- /// keeps only for the app's developer.
- public var isLeftToTheClick: Bool {
- switch self {
- case .crashReport: false
- case .holdsRepository, .sharedWithEveryone, .namedLikeTheApp, .holdsAnExclusion, .notMeasured, .couldNotBeRead,
- .holdsDocuments, .holdsALibrary, .holdsAWallet, .holdsAPasswordDatabase, .holdsLocalMail,
- .holdsMessageHistory, .holdsPasswordsOrCodes, .holdsVPNConnections, .holdsKeys, .holdsWorkKeptInACache,
- .insideAnotherAppsFolder, .beyondTheHelper, .leftToItsUninstaller, .keptByMacOS, .openedFromMail,
- .inTheCloud, .openInAProgram, .changedRecently, .keptByAnApp, .appIsRunning, .mayBeTheOnlyCopy,
- .encryptedImage: true
- }
- }
-
/// Why what a walk saw leaves a folder to be chosen by hand: a wallet, a signing key, or a repository inside may
/// exist nowhere else, and a folder the walk could not see into is not known to be empty.
static func seen(in contents: FolderContents?) -> HoldBack? {
@@ -181,10 +166,6 @@ public struct LeftoverMatch: Sendable, Hashable {
public var isRecommended: Bool { isTheAppsAlone && heldBack == nil }
- /// True when Select All passes the item by: held back for what it may hold, only guessed at, or used by another
- /// app or another copy of this one.
- public var isLeftToTheClick: Bool { heldBack?.isLeftToTheClick == true || confidence == .possible || isShared }
-
/// Returns the same match, held back for `heldBack`: shown, but never selected.
public func forReview(_ heldBack: HoldBack) -> LeftoverMatch {
LeftoverMatch(
diff --git a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
index 94ccbc8b..078a2bb9 100644
--- a/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Orphans/Orphan.swift
@@ -8,8 +8,8 @@ public struct OrphanItem: Sendable, Hashable, Identifiable {
/// When the item or anything inside it was last modified. Only its own date if it was not measured in time.
public let modificationDate: Date?
public let requiresPrivileges: Bool
- /// Why the item is left for the user to choose by hand, or nil. Select All passes it by, and `peel orphans
- /// --remove` leaves it where it is.
+ /// Why the item is left for the user to choose by hand, or nil. Select All asks before it selects it, and `peel
+ /// orphans --remove` leaves it where it is.
public var heldBack: HoldBack?
/// The bundle identifier of the app that left, when the item bears its name and nothing else ties the two.
public var namedAfter: String?
@@ -64,8 +64,7 @@ public struct OrphanGroup: Sendable, Hashable, Identifiable {
return SelectableRows(
rows: items.map(\.url),
selectable: unlocked.filter { $0.leftAlone == nil }.map(\.url),
- recommended: confidence.level == .unsure ? [] : unlocked.filter { $0.heldBack == nil }.map(\.url),
- leftToTheClick: items.filter { $0.heldBack?.isLeftToTheClick == true }.map(\.url)
+ recommended: confidence.level == .unsure ? [] : unlocked.filter { $0.heldBack == nil }.map(\.url)
)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift b/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
index 6ae7aab2..4d7a288a 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/BulkUninstallation.swift
@@ -35,11 +35,6 @@ public struct BulkUninstallation: Sendable {
public var id: URL { url }
- /// True when Select All passes the item by, as on one app's page (`LeftoverMatch.isLeftToTheClick`), and
- /// when an app outside the selection, another copy, or macOS uses it.
- public var isLeftToTheClick: Bool {
- match?.isLeftToTheClick == true || !sharedWithOthers.isEmpty || !otherCopies.isEmpty || isKeptByMacOS
- }
public var isApplication: Bool { match == nil }
public var isRecommended: Bool {
guard !isExcluded, !isPeels, !isKeptByMacOS, !isBeyondTheHelper, !isInTheTrash, enclosingPackage == nil
diff --git a/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift b/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
index 83098469..4549fe19 100644
--- a/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Removal/SelectableRows.swift
@@ -1,28 +1,20 @@
/// The rows of one list, for its Select All, Select Recommended and Deselect All: every row, those a click can
-/// select, and those Peel recommends.
+/// select, and those Peel recommends. Select All selects every row a click can select, and asks first about those
+/// Peel doesn't recommend.
public struct SelectableRows<ID: Hashable> {
public let rows: [ID]
public let selectable: [ID]
/// Never a row a click cannot select.
public let recommended: [ID]
- /// Rows a click can select and Select All passes by: what may exist nowhere else, belongs to something else, or
- /// is not known, which the person chooses one by one.
- public let leftToTheClick: [ID]
- public init(rows: [ID], selectable: [ID], recommended: [ID], leftToTheClick: [ID]) {
+ public init(rows: [ID], selectable: [ID], recommended: [ID]) {
self.rows = rows
self.selectable = selectable
self.recommended = recommended.filter(Set(selectable).contains)
- self.leftToTheClick = leftToTheClick.filter(Set(selectable).contains)
- }
-
- private var reachedBySelectAll: [ID] {
- let left = Set(leftToTheClick)
- return selectable.filter { !left.contains($0) }
}
public func isAllSelected(in selection: Set<ID>) -> Bool {
- reachedBySelectAll.allSatisfy(selection.contains)
+ selectable.allSatisfy(selection.contains)
}
public func isRecommendedSelected(in selection: Set<ID>) -> Bool {
@@ -34,14 +26,14 @@ public struct SelectableRows<ID: Hashable> {
}
public func selectingAll(in selection: Set<ID>) -> Set<ID> {
- selection.union(reachedBySelectAll)
+ selection.union(selectable)
}
public func selectingRecommended(in selection: Set<ID>) -> Set<ID> {
selection.subtracting(rows).union(recommended)
}
- /// Takes out every row of the list, one selected by hand that Select All would leave alone included.
+ /// Takes out every row of the list, one a click can no longer select included.
public func deselectingAll(in selection: Set<ID>) -> Set<ID> {
selection.subtracting(rows)
}
@@ -49,7 +41,7 @@ public struct SelectableRows<ID: Hashable> {
/// What Select All would add that Peel does not recommend, which it asks about first.
public func notRecommendedAdded(by selection: Set<ID>) -> [ID] {
let recommended = Set(recommended)
- return reachedBySelectAll.filter { !recommended.contains($0) && !selection.contains($0) }
+ return selectable.filter { !recommended.contains($0) && !selection.contains($0) }
}
}
@@ -68,8 +60,7 @@ public struct SelectablePages<Page: Hashable, ID: Hashable> {
rows = SelectableRows(
rows: once(pages.flatMap { $0.rows.rows }),
selectable: once(pages.flatMap { $0.rows.selectable }),
- recommended: once(pages.flatMap { $0.rows.recommended }),
- leftToTheClick: once(pages.flatMap { $0.rows.leftToTheClick })
+ recommended: once(pages.flatMap { $0.rows.recommended })
)
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
index 89669120..caabeab1 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
@@ -57,8 +57,7 @@ extension Collection where Element == InstallerItem {
return SelectableRows(
rows: map(\.url),
selectable: open.filter { $0.heldBack?.cannotBeMoved != true }.map(\.url),
- recommended: open.filter { $0.heldBack == nil }.map(\.url),
- leftToTheClick: filter { $0.heldBack?.isLeftToTheClick == true }.map(\.url)
+ recommended: open.filter { $0.heldBack == nil }.map(\.url)
)
}
}
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
index 21b8d6f0..70e82320 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/SpaceRemoval.swift
@@ -53,8 +53,7 @@ public enum SpaceRemoval {
return SelectableRows(
rows: removable,
selectable: unlocked.filter { heldBack[$0]?.cannotBeMoved != true },
- recommended: unlocked.filter(suggested.contains),
- leftToTheClick: removable.filter { heldBack[$0]?.isLeftToTheClick == true }
+ recommended: unlocked.filter(suggested.contains)
)
}
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 7a6e4380..79a0a623 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -916,7 +916,7 @@ struct DeveloperCachesTests {
#expect(DeveloperCaches.archive(at: directory.url.appending(path: "Pipe.xcarchive")) == nil)
}
- @Test func aCacheWithAWalletOrAPasswordDatabaseInsideIsLeftToTheClick() async throws {
+ @Test func aCacheWithAWalletOrAPasswordDatabaseInsideIsNeverRecommended() async throws {
let directory = try TemporaryDirectory()
try directory.file("Library/Caches/Homebrew/glide_home/coin/wallet.dat", bytes: 400_000)
try directory.file("Library/Caches/Homebrew/api-source/vault/passwords.kdbx", bytes: 400_000)
@@ -929,13 +929,13 @@ struct DeveloperCachesTests {
for name in ["glide_home", "api-source"] {
#expect(location(name)?.isRecommended == false)
- #expect(location(name)?.isLeftToTheClick == true)
}
#expect(location("glide_home")?.heldBack == .holdsAWallet)
#expect(location("api-source")?.heldBack == .holdsAPasswordDatabase)
#expect(location("go_cache")?.isRecommended == true)
#expect(location("gh-actions-artifact")?.isRecommended == true)
- #expect(Set(environment.selectableRows.leftToTheClick.map(\.lastPathComponent)) == ["glide_home", "api-source"])
+ let asked = Set(environment.selectableRows.notRecommendedAdded(by: []).map(\.lastPathComponent))
+ #expect(asked.isSuperset(of: ["glide_home", "api-source"]))
}
@Test func offersEveryCacheHomebrewNamesAndNeverItsCopyOfTheDefinitions() async throws {
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
index 0187853c..cde06d44 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
@@ -184,7 +184,7 @@ struct InstallersTests {
let rows = scan.items.selectableRows(canUseHelper: false)
#expect(Set(rows.recommended.map { PathPattern.comparablePath(of: $0) })
== Set([unknown, known].map { PathPattern.comparablePath(of: $0) }))
- #expect(Set(rows.leftToTheClick.map { PathPattern.comparablePath(of: $0) })
+ #expect(Set(rows.notRecommendedAdded(by: []).map { PathPattern.comparablePath(of: $0) })
== Set([photos, backup, secrets].map { PathPattern.comparablePath(of: $0) }))
}
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
index 9b6d6001..b2da28b6 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/SelectableRowsTests.swift
@@ -8,11 +8,11 @@ struct SelectableRowsTests {
private let log = URL(filePath: "/tmp/org.example.Log")
private let elsewhere = URL(filePath: "/tmp/org.example.Elsewhere")
- /// A row selected by hand that Select All leaves alone goes with Deselect All too: otherwise it would stay
+ /// A row still selected that a click can no longer select goes with Deselect All too: otherwise it would stay
/// selected unseen and move with the next small file.
@Test func deselectAllTakesOutARowSelectedByHand() {
let list = SelectableRows(
- rows: [repository, cache, log], selectable: [cache, log], recommended: [cache, log], leftToTheClick: []
+ rows: [repository, cache, log], selectable: [cache, log], recommended: [cache, log]
)
let selection: Set = [repository, cache, log, elsewhere]
@@ -22,28 +22,16 @@ struct SelectableRowsTests {
@Test func selectAllAddsWhatAClickCanSelect() {
let list = SelectableRows(
- rows: [repository, cache, log], selectable: [cache, log], recommended: [cache], leftToTheClick: []
+ rows: [repository, cache, log], selectable: [cache, log], recommended: [cache]
)
#expect(list.selectingAll(in: [elsewhere]) == [cache, log, elsewhere])
#expect(list.isAllSelected(in: [cache, log]))
}
- /// What may exist nowhere else, belong to something else, or is not known is left to a click: Select All passes
- /// it by, asks nothing about it, and a click still selects it.
- @Test func selectAllLeavesToTheClickWhatMayExistNowhereElse() {
- let list = SelectableRows(
- rows: [repository, cache, log], selectable: [repository, cache, log], recommended: [cache],
- leftToTheClick: [repository]
- )
-
- #expect(list.selectingAll(in: [elsewhere]) == [cache, log, elsewhere])
- #expect(list.isAllSelected(in: [cache, log]))
- #expect(list.notRecommendedAdded(by: []) == [log])
- #expect(list.selectable.contains(repository))
- }
-
- @Test func everyPageLeavesToTheClickWhatItHoldsBack() {
+ /// Select All selects every row a click can select, what Peel holds back included, and asks first about each
+ /// one Peel doesn't recommend: whoever wants everything gone can have it, once they have read the question.
+ @Test func selectAllTakesWhatEveryPageHoldsBackAfterAsking() {
func orphan(_ name: String, heldBack: HoldBack?) -> OrphanItem {
var item = OrphanItem(
url: URL(filePath: "/tmp/\(name)"), kind: .caches, size: 10, modificationDate: nil,
@@ -53,58 +41,39 @@ struct SelectableRowsTests {
return item
}
let messages = orphan("org.example.Messages", heldBack: .holdsMessageHistory)
- let report = orphan("org.example.Report", heldBack: .crashReport)
- let plain = orphan("org.example.Plain", heldBack: nil)
- let group = OrphanGroup(identifier: "org.example", items: [messages, report, plain])
- #expect(group.selectableRows(canUseHelper: true).leftToTheClick == [messages.url])
+ let orphans = OrphanGroup(identifier: "org.example", items: [messages]).selectableRows(canUseHelper: true)
+ #expect(orphans.selectingAll(in: []) == [messages.url])
+ #expect(orphans.notRecommendedAdded(by: []) == [messages.url])
let (cache, system) = (URL(filePath: "/tmp/org.example.Cache"), URL(filePath: "/tmp/com.apple.Cache"))
- let plan = SpaceRemoval.Plan(
+ let space = SpaceRemoval.Plan(
removable: [cache, system], inUse: [], leftToDeveloper: [], sizes: [cache: 1, system: 1],
heldBack: [system: .keptByMacOS], needsTheHelper: []
- )
- #expect(plan.selectableRows(canUseHelper: true).leftToTheClick == [system])
+ ).selectableRows(canUseHelper: true)
+ #expect(space.selectingAll(in: []) == [cache, system])
+ #expect(space.notRecommendedAdded(by: []) == [system])
let project = URL(filePath: "/tmp/org.example.Project")
- func artifact(_ name: String, generic: Bool) -> ProjectArtifact {
- ProjectArtifact(
- url: project.appending(path: name), project: project, name: name, tool: "Xcode", size: 10,
- lastActivity: .now.addingTimeInterval(-ProjectArtifacts.recentlyActive * 2),
- hasGenericName: generic, isEnvironment: false
- )
- }
- let (derived, build) = (artifact("DerivedData", generic: false), artifact("build", generic: true))
- #expect([derived, build].selectableRows.leftToTheClick == [build.url])
-
- let measured = DeveloperEnvironment.Location(
- url: URL(filePath: "/tmp/org.example.Cache"), kind: .cache, size: 10, source: "https://example.com"
- )
- let unknown = DeveloperEnvironment.Location(
- url: URL(filePath: "/tmp/org.example.Unknown"), kind: .cache, size: nil, source: "https://example.com"
+ let build = ProjectArtifact(
+ url: project.appending(path: "build"), project: project, name: "build", tool: "Xcode", size: 10,
+ lastActivity: .now.addingTimeInterval(-ProjectArtifacts.recentlyActive * 2),
+ hasGenericName: true, isEnvironment: false
)
+ #expect([build].selectableRows.selectingAll(in: []) == [build.url])
+
let archive = DeveloperEnvironment.Location(
url: URL(filePath: "/tmp/org.example.Archive"), kind: .archives, size: 10, source: "https://example.com"
)
let tool = DeveloperEnvironment(
- id: "org.example", name: "Example", systemImage: "hammer", appBundleIdentifiers: [],
- locations: [measured, unknown, archive]
+ id: "org.example", name: "Example", systemImage: "hammer", appBundleIdentifiers: [], locations: [archive]
)
- #expect(tool.selectableRows.leftToTheClick == [unknown.url, archive.url])
- }
-
- @Test func aLeftoverPeelGuessesAtOrSharesIsLeftToTheClick() {
- let certain = LeftoverMatch(reason: .bundleIdentifier, confidence: .certain, sharedWith: [])
- #expect(!certain.isLeftToTheClick)
- #expect(LeftoverMatch(reason: .namePrefix, confidence: .possible, sharedWith: []).isLeftToTheClick)
- #expect(LeftoverMatch(reason: .bundleIdentifier, confidence: .certain, sharedWith: ["org.example.other"]).isLeftToTheClick)
- #expect(certain.forReview(.holdsMessageHistory).isLeftToTheClick)
- #expect(!certain.forReview(.crashReport).isLeftToTheClick)
+ #expect(tool.selectableRows.selectingAll(in: []) == [archive.url])
+ #expect(tool.selectableRows.isAllSelected(in: [archive.url]))
}
@Test func selectRecommendedTakesOutWhatPeelDoesNotRecommend() {
let list = SelectableRows(
- rows: [repository, cache, log], selectable: [repository, cache, log], recommended: [cache],
- leftToTheClick: []
+ rows: [repository, cache, log], selectable: [repository, cache, log], recommended: [cache]
)
let selection: Set = [repository, log, elsewhere]
@@ -116,22 +85,21 @@ struct SelectableRowsTests {
@Test func selectAllAsksOnlyAboutWhatPeelDoesNotRecommend() {
let list = SelectableRows(
- rows: [repository, cache, log], selectable: [repository, cache, log], recommended: [cache],
- leftToTheClick: []
+ rows: [repository, cache, log], selectable: [repository, cache, log], recommended: [cache]
)
#expect(list.notRecommendedAdded(by: []) == [repository, log])
#expect(list.notRecommendedAdded(by: [repository]) == [log])
#expect(list.notRecommendedAdded(by: [repository, log]).isEmpty)
let everything = SelectableRows(
- rows: [cache, log], selectable: [cache, log], recommended: [cache, log], leftToTheClick: []
+ rows: [cache, log], selectable: [cache, log], recommended: [cache, log]
)
#expect(everything.notRecommendedAdded(by: []).isEmpty)
}
@Test func peelNeverRecommendsWhatAClickCannotSelect() {
let list = SelectableRows(
- rows: [repository, cache], selectable: [cache], recommended: [repository, cache], leftToTheClick: []
+ rows: [repository, cache], selectable: [cache], recommended: [repository, cache]
)
#expect(list.recommended == [cache])
@@ -140,26 +108,26 @@ struct SelectableRowsTests {
@Test func deselectAllLeavesOtherListsAlone() {
let list = SelectableRows(
- rows: [cache, log], selectable: [cache, log], recommended: [cache], leftToTheClick: []
+ rows: [cache, log], selectable: [cache, log], recommended: [cache]
)
#expect(list.isNoneSelected(in: [elsewhere]))
#expect(!list.isNoneSelected(in: [log, elsewhere]))
#expect(list.deselectingAll(in: [log, elsewhere]) == [elsewhere])
let locked = SelectableRows(
- rows: [repository, cache], selectable: [cache], recommended: [cache], leftToTheClick: []
+ rows: [repository, cache], selectable: [cache], recommended: [cache]
)
#expect(!locked.isNoneSelected(in: [repository]))
}
@Test func everyPageSelectsAsOneList() {
let first = SelectableRows(
- rows: [repository, cache], selectable: [repository, cache], recommended: [cache], leftToTheClick: []
+ rows: [repository, cache], selectable: [repository, cache], recommended: [cache]
)
let second = SelectableRows(
- rows: [repository, log], selectable: [repository, log], recommended: [log], leftToTheClick: []
+ rows: [repository, log], selectable: [repository, log], recommended: [log]
)
- let locked = SelectableRows(rows: [elsewhere], selectable: [], recommended: [], leftToTheClick: [])
+ let locked = SelectableRows(rows: [elsewhere], selectable: [], recommended: [])
let pages = SelectablePages([("first", first), ("second", second), ("locked", locked)])
#expect(pages.rows.rows == [repository, cache, log, elsewhere])
@@ -170,10 +138,10 @@ struct SelectableRowsTests {
@Test func aPageCountsOnceSomethingOnItIsSelected() {
let first = SelectableRows(
- rows: [repository, cache], selectable: [repository, cache], recommended: [cache], leftToTheClick: []
+ rows: [repository, cache], selectable: [repository, cache], recommended: [cache]
)
let second = SelectableRows(
- rows: [repository, log], selectable: [repository, log], recommended: [log], leftToTheClick: []
+ rows: [repository, log], selectable: [repository, log], recommended: [log]
)
let pages = SelectablePages([("first", first), ("second", second)])
@@ -183,11 +151,11 @@ struct SelectableRowsTests {
}
@Test func aRowOnAPageNotSeenYetCountsAsNotSelected() {
- let first = SelectableRows(rows: [cache], selectable: [cache], recommended: [cache], leftToTheClick: [])
+ let first = SelectableRows(rows: [cache], selectable: [cache], recommended: [cache])
let second = SelectableRows(
- rows: [log, repository], selectable: [log, repository], recommended: [log], leftToTheClick: []
+ rows: [log, repository], selectable: [log, repository], recommended: [log]
)
- let shared = SelectableRows(rows: [repository], selectable: [repository], recommended: [], leftToTheClick: [])
+ let shared = SelectableRows(rows: [repository], selectable: [repository], recommended: [])
let pages = SelectablePages([("first", first), ("second", second), ("shared", shared)])
let preselected: Set = [cache, log, repository, elsewhere]
diff --git a/Peel/Views/AppDetailView.swift b/Peel/Views/AppDetailView.swift
index 3bae28e0..285f2bbb 100644
--- a/Peel/Views/AppDetailView.swift
+++ b/Peel/Views/AppDetailView.swift
@@ -285,8 +285,7 @@ struct AppDetailView: View {
),
movable: plan.recommendedMovable,
list: SelectableRows(
- rows: recommendedRows, selectable: recommendedSelectable, recommended: recommendedSelectable,
- leftToTheClick: []
+ rows: recommendedRows, selectable: recommendedSelectable, recommended: recommendedSelectable
),
place: Text("Recommended")
)
@@ -321,8 +320,7 @@ struct AppDetailView: View {
list: SelectableRows(
rows: plan.needsReview.map(\.url),
selectable: plan.needsReview.map(\.url).filter(plan.selectable.contains),
- recommended: [],
- leftToTheClick: plan.needsReview.filter(\.match.isLeftToTheClick).map(\.url)
+ recommended: []
),
place: Text("Review Before Removing")
)
diff --git a/Peel/Views/Cloud/CloudView.swift b/Peel/Views/Cloud/CloudView.swift
index 103e9856..2474691b 100644
--- a/Peel/Views/Cloud/CloudView.swift
+++ b/Peel/Views/Cloud/CloudView.swift
@@ -66,8 +66,7 @@ struct CloudView: View {
SelectMenu(
list: SelectableRows(
rows: listed.map(\.url), selectable: listed.map(\.url),
- recommended: listed.filter { !$0.isDesktopPicture }.map(\.url),
- leftToTheClick: listed.filter(\.isDesktopPicture).map(\.url)
+ recommended: listed.filter { !$0.isDesktopPicture }.map(\.url)
),
place: Text(Tool.cloud.title),
selection: cloud
diff --git a/Peel/Views/FileSearch/FileSearchList.swift b/Peel/Views/FileSearch/FileSearchList.swift
index ba0b0950..351b03f2 100644
--- a/Peel/Views/FileSearch/FileSearchList.swift
+++ b/Peel/Views/FileSearch/FileSearchList.swift
@@ -45,8 +45,7 @@ struct FileSearchList: View {
list: SelectableRows(
rows: results.files.map(\.url),
selectable: results.files.filter { !$0.requiresPrivileges }.map(\.url),
- recommended: results.files.map(\.url).filter(search.recommendedURLs.contains),
- leftToTheClick: results.files.filter(\.isInTheCloud).map(\.url)
+ recommended: results.files.map(\.url).filter(search.recommendedURLs.contains)
),
place: Text(Tool.fileSearch.title),
selection: search
diff --git a/Peel/Views/MultipleAppsView.swift b/Peel/Views/MultipleAppsView.swift
index 1e1f4c3e..553c1c70 100644
--- a/Peel/Views/MultipleAppsView.swift
+++ b/Peel/Views/MultipleAppsView.swift
@@ -224,8 +224,7 @@ struct MultipleAppsView: View {
return SelectableRows(
rows: rows,
selectable: rows.filter(plan.selectable.contains),
- recommended: rows.filter(plan.suggested.contains),
- leftToTheClick: items.filter(\.isLeftToTheClick).map(\.url)
+ recommended: rows.filter(plan.suggested.contains)
)
}
diff --git a/Peel/Views/Packages/PackageDetailView.swift b/Peel/Views/Packages/PackageDetailView.swift
index 43a4f550..e787bbc0 100644
--- a/Peel/Views/Packages/PackageDetailView.swift
+++ b/Peel/Views/Packages/PackageDetailView.swift
@@ -162,8 +162,7 @@ struct PackageDetailView: View {
SelectableRows(
rows: receipt.items.map(\.url),
selectable: receipt.items.filter { !isLocked($0) && !$0.isLeftAlone }.map(\.url),
- recommended: receipt.items.filter { !isLocked($0) && !$0.isLeftAlone && $0.heldBack == nil }.map(\.url),
- leftToTheClick: receipt.items.filter { $0.heldBack?.isLeftToTheClick == true }.map(\.url)
+ recommended: receipt.items.filter { !isLocked($0) && !$0.isLeftAlone && $0.heldBack == nil }.map(\.url)
)
}
diff --git a/Peel/Views/ResetSheet.swift b/Peel/Views/ResetSheet.swift
index c1f7a118..c0b1c23f 100644
--- a/Peel/Views/ResetSheet.swift
+++ b/Peel/Views/ResetSheet.swift
@@ -141,8 +141,7 @@ struct ResetSheet: View {
list: SelectableRows(
rows: items.map(\.url),
selectable: items.map(\.url),
- recommended: items.map(\.url).filter(plan.suggested.contains),
- leftToTheClick: []
+ recommended: items.map(\.url).filter(plan.suggested.contains)
),
place: Text(group.title),
selection: plan
diff --git a/Peel/Views/SelectAllButton.swift b/Peel/Views/SelectAllButton.swift
index 8a6d3a3a..f2b9a031 100644
--- a/Peel/Views/SelectAllButton.swift
+++ b/Peel/Views/SelectAllButton.swift
@@ -11,7 +11,7 @@ struct SelectAllButton<ID: Hashable>: View {
var body: some View {
if !selectable.isEmpty {
- let list = SelectableRows(rows: rows, selectable: selectable, recommended: selectable, leftToTheClick: [])
+ let list = SelectableRows(rows: rows, selectable: selectable, recommended: selectable)
let isAllSelected = list.isAllSelected(in: selection)
Button {
selection = isAllSelected ? list.deselectingAll(in: selection) : list.selectingAll(in: selection)
diff --git a/SAFETY.md b/SAFETY.md
index 627fe70c..a5d4b020 100644
--- a/SAFETY.md
+++ b/SAFETY.md
@@ -273,9 +273,9 @@ Orphaned Files selects nothing for you, and `peel orphans --remove` leaves these
`/Users/Shared`, one with a repository, a wallet, a signing key, or a password database inside, one that may hold what
exists only on this Mac, or one Peel could not read or measure in time, moves only when you select it yourself.
-On every list, Select All passes by what Peel holds back for what it may hold, what it only guesses belongs to the
-app, what another app also uses, and macOS's own caches: each is selected only with its own click, after its reason
-has been read. What else Select All adds that Peel doesn't recommend, it asks about first.
+On every list, Select All selects every row you can select, what Peel holds back included, and asks first,
+counting what Peel doesn't recommend; Return answers Select Recommended. Each held back row still shows its reason
+beside it.
In Duplicates, one copy of every group always stays, and a file that changed since the scan is refused. Nothing
inside an app or another package is ever offered, nor a hidden folder, such as a tool's settings in `~/.config`:
@@ -313,8 +313,9 @@ A wallet's keys can be the only way to what they hold, so Peel keeps them in fou
wallets and key tools give their files: anything called `wallet.dat`, `wallets`, `keystore`, `seed.dat`,
`hsm_secret`, or `channel.backup`, anything ending in `.wallet` or `.keys`, and the others `FileSize.isWallet`
lists. A folder with one inside is shown with that reason and never selected for you, not by `peel uninstall`,
- `peel orphans --remove`, `peel caches --remove`, `peel projects --remove`, or Select All. You can still select it
- yourself, because a name can mislead: a Java project keeps a `keystore` too.
+ `peel orphans --remove`, `peel caches --remove`, or `peel projects --remove`. You can still select it yourself,
+ with its own click or with Select All once you have answered its question, because a name can mislead: a Java
+ project keeps a `keystore` too.
- **A folder Peel could not finish reading is treated the same way**, whether it ran out of time or macOS kept a
folder inside it closed. A coin's data folder, with its blockchain, is the one most likely to be too big to read
in time, and its wallet may be inside.