mirror of
https://github.com/mas-cli/mas
synced 2024-11-22 11:33:13 +00:00
appIDValue
to encapsulate uint64Value
.
Resolve #574 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
8c5890f46d
commit
b0d0f4aacd
3 changed files with 12 additions and 5 deletions
|
@ -33,7 +33,7 @@ extension Mas {
|
||||||
fulfilled:
|
fulfilled:
|
||||||
appLibrary.installedApps.map { installedApp in
|
appLibrary.installedApps.map { installedApp in
|
||||||
firstly {
|
firstly {
|
||||||
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
|
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
|
||||||
}.done { storeApp in
|
}.done { storeApp in
|
||||||
guard let storeApp else {
|
guard let storeApp else {
|
||||||
if verbose {
|
if verbose {
|
||||||
|
|
|
@ -44,7 +44,7 @@ extension Mas {
|
||||||
.joined(separator: "\n"))
|
.joined(separator: "\n"))
|
||||||
|
|
||||||
do {
|
do {
|
||||||
try downloadAll(apps.map(\.installedApp.itemIdentifier.uint64Value)).wait()
|
try downloadAll(apps.map(\.installedApp.itemIdentifier.appIDValue)).wait()
|
||||||
} catch {
|
} catch {
|
||||||
throw error as? MASError ?? .downloadFailed(error: error as NSError)
|
throw error as? MASError ?? .downloadFailed(error: error as NSError)
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ extension Mas {
|
||||||
let promises = apps.map { installedApp in
|
let promises = apps.map { installedApp in
|
||||||
// only upgrade apps whose local version differs from the store version
|
// only upgrade apps whose local version differs from the store version
|
||||||
firstly {
|
firstly {
|
||||||
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
|
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
|
||||||
}.map { result -> (SoftwareProduct, SearchResult)? in
|
}.map { result -> (SoftwareProduct, SearchResult)? in
|
||||||
guard let storeApp = result, installedApp.isOutdatedWhenComparedTo(storeApp) else {
|
guard let storeApp = result, installedApp.isOutdatedWhenComparedTo(storeApp) else {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -7,10 +7,9 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import ArgumentParser
|
import ArgumentParser
|
||||||
|
import Foundation
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
|
||||||
typealias AppID = UInt64
|
|
||||||
|
|
||||||
@main
|
@main
|
||||||
struct Mas: ParsableCommand {
|
struct Mas: ParsableCommand {
|
||||||
static let configuration = CommandConfiguration(
|
static let configuration = CommandConfiguration(
|
||||||
|
@ -56,3 +55,11 @@ struct Mas: ParsableCommand {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typealias AppID = UInt64
|
||||||
|
|
||||||
|
extension NSNumber {
|
||||||
|
var appIDValue: AppID {
|
||||||
|
uint64Value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue