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 VS Code among the inventory's sources

Țugui Dragoșb48940df7de0
diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
index ad1f39e6..846e3251 100644
--- a/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Apps/Inventory.swift
@@ -7,7 +7,8 @@ public struct InventoryEntry: Sendable, Hashable, Codable {
public let bundleIdentifier: String?
public let version: String?
public let build: String?
- /// Where the app came from: "Homebrew", "App Store", "Setapp", "Sparkle", "Electron", "Downloaded", or "Unknown".
+ /// Where the app came from: "Homebrew", "App Store", "Setapp", "Sparkle", "Electron", "VS Code", "Downloaded", or
+ /// "Unknown".
public let source: String
/// What identifies the app in that source: a cask token, a feed address, or the address it was downloaded from.
public let sourceDetail: String?
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
index 9bec852e..9af7e66c 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InventoryTests.swift
@@ -25,12 +25,14 @@ struct InventoryTests {
/// receipt inside the bundle says App Store.
@Test func namesWhereEachAppCameFrom() {
let cask = HomebrewPackage(name: "bear", kind: .cask, installedVersion: "2.0", appNames: ["Bear.app"])
+ let service = "https://update.code.visualstudio.com/api/update/darwin-arm64/stable/\(String(repeating: "0", count: 40))"
let inventory = Inventory.build(
apps: [
app("Bear", bundleIdentifier: "net.shinyfrog.bear"),
app("Shazam", bundleIdentifier: "com.shazam.mac", isFromAppStore: true),
app("AdGuard", bundleIdentifier: "com.adguard.mac", feed: .sparkle(URL(string: "https://example.com/appcast.xml")!)),
app("Code", bundleIdentifier: "com.microsoft.VSCode", feed: .appStore(.mac)),
+ app("Editor", bundleIdentifier: "org.example.Editor", feed: .vsCode(URL(string: service)!)),
app("Nothing", bundleIdentifier: "com.example.nothing"),
app("Sample", bundleIdentifier: "org.example.Sample-setapp", feed: .sparkle(URL(string: "https://example.com/setapp.xml")!)),
],
@@ -45,6 +47,8 @@ struct InventoryTests {
#expect(sources["Shazam"] == "App Store")
#expect(sources["AdGuard"] == "Sparkle")
#expect(sources["Code"] == "Unknown")
+ #expect(sources["Editor"] == "VS Code")
+ #expect(inventory.entries.first { $0.name == "Editor" }?.sourceDetail == service)
#expect(sources["Nothing"] == "Unknown")
#expect(sources["Sample"] == "Setapp", "Setapp keeps the app up to date, whatever feed it also carries")
#expect(inventory.entries.first { $0.name == "Bear" }?.sourceDetail == "bear")