|
6 | 6 | // |
7 | 7 |
|
8 | 8 | import CorkShared |
9 | | -import Foundation |
10 | 9 | import CorkTerminalFunctions |
| 10 | +import Foundation |
11 | 11 |
|
12 | 12 | enum BrewPackageInfoLoadingError: LocalizedError |
13 | 13 | { |
@@ -56,7 +56,24 @@ extension BrewPackage |
56 | 56 |
|
57 | 57 | struct Installed: Codable |
58 | 58 | { |
59 | | - let installedAsDependency: Bool |
| 59 | + /// Backwards compatibility before `installedOnRequest` was added |
| 60 | + let installedAsDependency: Bool? |
| 61 | + |
| 62 | + /// ``true`` when **NOT** a dependency, ``false`` **WHEN** a dependency |
| 63 | + let installedOnRequest: Bool? |
| 64 | + |
| 65 | + var isDependencyOfAnotherPackage: Bool |
| 66 | + { |
| 67 | + if let installedOnRequest = installedOnRequest |
| 68 | + { |
| 69 | + return !installedOnRequest |
| 70 | + } |
| 71 | + if let installedAsDependency = installedAsDependency |
| 72 | + { |
| 73 | + return installedAsDependency |
| 74 | + } |
| 75 | + return false |
| 76 | + } |
60 | 77 |
|
61 | 78 | struct RuntimeDependencies: Codable |
62 | 79 | { |
@@ -177,7 +194,7 @@ extension BrewPackage |
177 | 194 |
|
178 | 195 | /// Whether the cask was installed as dependency |
179 | 196 | /// Always false, since Casks can't have dependencies or be dependants |
180 | | - let installedAsDependency: Bool = false |
| 197 | + let isDependencyOfAnotherPackage: Bool = false |
181 | 198 |
|
182 | 199 | /// Whether the cas is outdated |
183 | 200 | let outdated: Bool |
@@ -335,7 +352,7 @@ extension BrewPackage |
335 | 352 | description: formulaInfo.desc, |
336 | 353 | homepage: formulaInfo.homepage, |
337 | 354 | tap: .init(name: formulaInfo.tap), |
338 | | - installedAsDependency: formulaInfo.installed.first?.installedAsDependency ?? false, |
| 355 | + installedAsDependency: formulaInfo.installed.first?.isDependencyOfAnotherPackage ?? false, |
339 | 356 | dependencies: formulaInfo.extractDependencies(), |
340 | 357 | outdated: formulaInfo.outdated, |
341 | 358 | caveats: formulaInfo.caveats, |
|
0 commit comments