Skip to content

Commit

Permalink
Rename apps property of Upgrade as appIds.
Browse files Browse the repository at this point in the history
Resolve mas-cli#542

Signed-off-by: Ross Goldberg <[email protected]>
  • Loading branch information
rgoldberg committed Oct 6, 2024
1 parent b0409ab commit 7728431
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Sources/mas/Commands/Upgrade.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension Mas {
)

@Argument(help: "app(s) to upgrade")
var apps: [String] = []
var appIds: [String] = []

/// Runs the command.
func run() throws {
Expand All @@ -43,9 +43,8 @@ extension Mas {
apps.map { "\($0.installedApp.appName) (\($0.installedApp.bundleVersion)) -> (\($0.storeApp.version))" }
.joined(separator: "\n"))

let appIds = apps.map(\.installedApp.itemIdentifier.uint64Value)
do {
try downloadAll(appIds).wait()
try downloadAll(apps.map(\.installedApp.itemIdentifier.uint64Value)).wait()
} catch {
throw error as? MASError ?? .downloadFailed(error: error as NSError)
}
Expand All @@ -56,9 +55,9 @@ extension Mas {
storeSearch: StoreSearch
) throws -> [(SoftwareProduct, SearchResult)] {
let apps: [SoftwareProduct] =
apps.isEmpty
appIds.isEmpty
? appLibrary.installedApps
: apps.compactMap {
: appIds.compactMap {
if let appId = UInt64($0) {
// if argument a UInt64, lookup app by id using argument
return appLibrary.installedApp(forId: appId)
Expand Down

0 comments on commit 7728431

Please sign in to comment.