mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Merge pull request #575 from rgoldberg/574-app-id-value
`appIDValue` to encapsulate `uint64Value`.
This commit is contained in:
commit
de13ad12f5
3 changed files with 12 additions and 5 deletions
|
@ -33,7 +33,7 @@ extension Mas {
|
|||
fulfilled:
|
||||
appLibrary.installedApps.map { installedApp in
|
||||
firstly {
|
||||
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
|
||||
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
|
||||
}.done { storeApp in
|
||||
guard let storeApp else {
|
||||
if verbose {
|
||||
|
|
|
@ -44,7 +44,7 @@ extension Mas {
|
|||
.joined(separator: "\n"))
|
||||
|
||||
do {
|
||||
try downloadAll(apps.map(\.installedApp.itemIdentifier.uint64Value)).wait()
|
||||
try downloadAll(apps.map(\.installedApp.itemIdentifier.appIDValue)).wait()
|
||||
} catch {
|
||||
throw error as? MASError ?? .downloadFailed(error: error as NSError)
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ extension Mas {
|
|||
let promises = apps.map { installedApp in
|
||||
// only upgrade apps whose local version differs from the store version
|
||||
firstly {
|
||||
storeSearch.lookup(appID: installedApp.itemIdentifier.uint64Value)
|
||||
storeSearch.lookup(appID: installedApp.itemIdentifier.appIDValue)
|
||||
}.map { result -> (SoftwareProduct, SearchResult)? in
|
||||
guard let storeApp = result, installedApp.isOutdatedWhenComparedTo(storeApp) else {
|
||||
return nil
|
||||
|
|
|
@ -7,10 +7,9 @@
|
|||
//
|
||||
|
||||
import ArgumentParser
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
typealias AppID = UInt64
|
||||
|
||||
@main
|
||||
struct Mas: ParsableCommand {
|
||||
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