mirror of
https://github.com/mas-cli/mas
synced 2024-11-21 19:23:01 +00:00
Rename some uses of appName
as searchTerm
.
Partial #585 Signed-off-by: Ross Goldberg <484615+rgoldberg@users.noreply.github.com>
This commit is contained in:
parent
0e49da7bf1
commit
0b11f3737c
4 changed files with 7 additions and 7 deletions
|
@ -21,7 +21,7 @@ extension Mas {
|
|||
@Flag(help: "force reinstall")
|
||||
var force = false
|
||||
@Argument(help: "the app name to install")
|
||||
var appName: String
|
||||
var searchTerm: String
|
||||
|
||||
/// Runs the command.
|
||||
func run() throws {
|
||||
|
@ -32,7 +32,7 @@ extension Mas {
|
|||
var appID: AppID?
|
||||
|
||||
do {
|
||||
let results = try storeSearch.search(for: appName).wait()
|
||||
let results = try storeSearch.search(for: searchTerm).wait()
|
||||
guard let result = results.first else {
|
||||
printError("No results found")
|
||||
throw MASError.noSearchResultsFound
|
||||
|
|
|
@ -20,7 +20,7 @@ extension Mas {
|
|||
@Flag(help: "Show price of found apps")
|
||||
var price = false
|
||||
@Argument(help: "the app name to search")
|
||||
var appName: String
|
||||
var searchTerm: String
|
||||
|
||||
func run() throws {
|
||||
try run(storeSearch: MasStoreSearch())
|
||||
|
@ -28,7 +28,7 @@ extension Mas {
|
|||
|
||||
func run(storeSearch: StoreSearch) throws {
|
||||
do {
|
||||
let results = try storeSearch.search(for: appName).wait()
|
||||
let results = try storeSearch.search(for: searchTerm).wait()
|
||||
if results.isEmpty {
|
||||
throw MASError.noSearchResultsFound
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ import PromiseKit
|
|||
/// Protocol for searching the MAS catalog.
|
||||
protocol StoreSearch {
|
||||
func lookup(appID: AppID) -> Promise<SearchResult?>
|
||||
func search(for appName: String) -> Promise<[SearchResult]>
|
||||
func search(for searchTerm: String) -> Promise<[SearchResult]>
|
||||
}
|
||||
|
||||
enum Entity: String {
|
||||
|
|
|
@ -13,8 +13,8 @@ import PromiseKit
|
|||
class StoreSearchMock: StoreSearch {
|
||||
var apps: [AppID: SearchResult] = [:]
|
||||
|
||||
func search(for appName: String) -> Promise<[SearchResult]> {
|
||||
.value(apps.filter { $1.trackName.contains(appName) }.map { $1 })
|
||||
func search(for searchTerm: String) -> Promise<[SearchResult]> {
|
||||
.value(apps.filter { $1.trackName.contains(searchTerm) }.map { $1 })
|
||||
}
|
||||
|
||||
func lookup(appID: AppID) -> Promise<SearchResult?> {
|
||||
|
|
Loading…
Reference in a new issue