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.

Count only Orphaned Files' groups as groups

Țugui Dragoșede229c765ef
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 1180c882..04789ae1 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -205916,6 +205916,346 @@
}
}
},
+ "^[%lld item](inflect: true) only an administrator can move." : {
+ "localizations" : {
+ "cs" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld položky, které může přesunout jen správce."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld položky, které může přesunout jen správce."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld položka, kterou může přesunout jen správce."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld položek, které může přesunout jen správce."
+ }
+ }
+ }
+ }
+ },
+ "de" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld Objekt, das nur ein Administrator verschieben kann."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld Objekte, die nur ein Administrator verschieben kann."
+ }
+ }
+ }
+ }
+ },
+ "es" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld de ítems que solo un administrador puede trasladar."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Un ítem que solo un administrador puede trasladar."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld ítems que solo un administrador puede trasladar."
+ }
+ }
+ }
+ }
+ },
+ "fr" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld d’éléments que seul un administrateur peut déplacer."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld élément que seul un administrateur peut déplacer."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld éléments que seul un administrateur peut déplacer."
+ }
+ }
+ }
+ }
+ },
+ "it" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld di elementi che solo un amministratore può spostare."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Un elemento che solo un amministratore può spostare."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld elementi che solo un amministratore può spostare."
+ }
+ }
+ }
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "管理者しか移動できない項目が%lld個あります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "관리자만 이동할 수 있는 항목 %lld개."
+ }
+ },
+ "nl" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld onderdeel dat alleen een beheerder kan verplaatsen."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld onderdelen die alleen een beheerder kan verplaatsen."
+ }
+ }
+ }
+ }
+ },
+ "pl" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld rzeczy, które może przenieść tylko administrator."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld rzeczy, które może przenieść tylko administrator."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld rzecz, którą może przenieść tylko administrator."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld rzeczy, które może przenieść tylko administrator."
+ }
+ }
+ }
+ }
+ },
+ "pt" : {
+ "variations" : {
+ "plural" : {
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld de itens que só um administrador pode mover."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld item que só um administrador pode mover."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld itens que só um administrador pode mover."
+ }
+ }
+ }
+ }
+ },
+ "ro" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld articole pe care doar un administrator le poate muta."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld articol pe care doar un administrator îl poate muta."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld de articole pe care doar un administrator le poate muta."
+ }
+ }
+ }
+ }
+ },
+ "ru" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld объекта, которые может переместить только администратор."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld объектов, которые может переместить только администратор."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld объект, который может переместить только администратор."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld объекта, которые может переместить только администратор."
+ }
+ }
+ }
+ }
+ },
+ "sv" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld objekt som bara en administratör kan flytta."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld objekt som bara en administratör kan flytta."
+ }
+ }
+ }
+ }
+ },
+ "tr" : {
+ "variations" : {
+ "plural" : {
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yalnızca bir yöneticinin taşıyabileceği %lld öğe."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Yalnızca bir yöneticinin taşıyabileceği %lld öğe."
+ }
+ }
+ }
+ }
+ },
+ "uk" : {
+ "variations" : {
+ "plural" : {
+ "few" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld елементи, які може перемістити лише адміністратор."
+ }
+ },
+ "many" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld елементів, які може перемістити лише адміністратор."
+ }
+ },
+ "one" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld елемент, який може перемістити лише адміністратор."
+ }
+ },
+ "other" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld елемента, які може перемістити лише адміністратор."
+ }
+ }
+ }
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld个只有管理员才能移动的项目。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld個項目只有管理者能移動。"
+ }
+ }
+ }
+ },
"^[%lld item](inflect: true) selected of ^[%lld copy](inflect: true) in ^[%lld group](inflect: true). Choose one to review its copies." : {
"localizations" : {
"cs" : {
diff --git a/Peel/Model/FoundLastTimeStore.swift b/Peel/Model/FoundLastTimeStore.swift
index 03c9ec99..9a805bc5 100644
--- a/Peel/Model/FoundLastTimeStore.swift
+++ b/Peel/Model/FoundLastTimeStore.swift
@@ -42,9 +42,9 @@ extension AppLibrary {
}
extension OrphanLibrary {
- /// Each row of the list counts, what only an administrator can move as one, and only what Peel can move is sized.
+ /// The groups, sized by what Peel can move. What only an administrator can move is no group of Peel's to free.
var looked: Looked? {
- scan.map { Looked(count: pages.count, size: SizeTotal(combining: $0.groups.map(\.movable))) }
+ scan.map { Looked(count: $0.groups.count, size: SizeTotal(combining: $0.groups.map(\.movable))) }
}
}
diff --git a/Peel/Views/ToolSummaries.swift b/Peel/Views/ToolSummaries.swift
index d7bee42d..64737be4 100644
--- a/Peel/Views/ToolSummaries.swift
+++ b/Peel/Views/ToolSummaries.swift
@@ -77,7 +77,14 @@ extension AppLibrary {
}
extension OrphanLibrary {
- var summary: AttributedString? { Tool.orphans.summary(of: looked) }
+ var summary: AttributedString? {
+ Self.summary(groups: Tool.orphans.summary(of: looked), forAnAdministrator: scan?.forAnAdministrator.count ?? 0)
+ }
+
+ /// The groups' sentence, or, with no group, how many items only an administrator can move.
+ static func summary(groups: AttributedString?, forAnAdministrator count: Int) -> AttributedString? {
+ groups ?? (count > 0 ? AttributedString(localized: "^[\(count) item](inflect: true) only an administrator can move.") : nil)
+ }
}
extension DeveloperLibrary {
diff --git a/PeelTests/OrphanSummaryTests.swift b/PeelTests/OrphanSummaryTests.swift
new file mode 100644
index 00000000..f457c2de
--- /dev/null
+++ b/PeelTests/OrphanSummaryTests.swift
@@ -0,0 +1,12 @@
+import Foundation
+@testable import Peel
+import Testing
+
+@MainActor
+struct OrphanSummaryTests {
+ @Test func saysWhatOnlyAnAdministratorCanMoveApartFromTheGroups() {
+ #expect(OrphanLibrary.summary(groups: nil, forAnAdministrator: 0) == nil)
+ #expect(OrphanLibrary.summary(groups: nil, forAnAdministrator: 2).map { String($0.characters) }
+ == "2 items only an administrator can move.")
+ }
+}