mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Improve upgrade
unknown app ID/name error output.
Don't output a warning if nothing requires an upgrade. Partial #533 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
3d264675bf
commit
64ab55718a
2 changed files with 13 additions and 6 deletions
|
@ -35,7 +35,6 @@ extension MAS {
|
||||||
}
|
}
|
||||||
|
|
||||||
guard !apps.isEmpty else {
|
guard !apps.isEmpty else {
|
||||||
printWarning("Nothing found to upgrade")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,14 +58,22 @@ extension MAS {
|
||||||
let apps =
|
let apps =
|
||||||
appIDOrNames.isEmpty
|
appIDOrNames.isEmpty
|
||||||
? appLibrary.installedApps
|
? appLibrary.installedApps
|
||||||
: appIDOrNames.flatMap { appID in
|
: appIDOrNames.flatMap { appIDOrName in
|
||||||
if let appID = AppID(appID) {
|
if let appID = AppID(appIDOrName) {
|
||||||
// argument is an AppID, lookup apps by id using argument
|
// argument is an AppID, lookup apps by id using argument
|
||||||
return appLibrary.installedApps(withAppID: appID)
|
let installedApps = appLibrary.installedApps(withAppID: appID)
|
||||||
|
if installedApps.isEmpty {
|
||||||
|
printError("Unknown app ID \(appID)")
|
||||||
|
}
|
||||||
|
return installedApps
|
||||||
}
|
}
|
||||||
|
|
||||||
// argument is not an AppID, lookup apps by name using argument
|
// argument is not an AppID, lookup apps by name using argument
|
||||||
return appLibrary.installedApps(named: appID)
|
let installedApps = appLibrary.installedApps(named: appIDOrName)
|
||||||
|
if installedApps.isEmpty {
|
||||||
|
printError("Unknown app name '\(appIDOrName)'")
|
||||||
|
}
|
||||||
|
return installedApps
|
||||||
}
|
}
|
||||||
|
|
||||||
let promises = apps.map { installedApp in
|
let promises = apps.map { installedApp in
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class UpgradeSpec: QuickSpec {
|
||||||
.run(appLibrary: MockAppLibrary(), searcher: MockAppStoreSearcher())
|
.run(appLibrary: MockAppLibrary(), searcher: MockAppStoreSearcher())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
== "Warning: Nothing found to upgrade\n"
|
.toNot(throwError())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue