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:
Ross Goldberg 2024-10-25 13:04:06 -04:00
parent 0e49da7bf1
commit 0b11f3737c
No known key found for this signature in database
4 changed files with 7 additions and 7 deletions

View file

@ -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

View file

@ -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
}

View file

@ -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 {

View file

@ -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?> {