mirror of
https://github.com/mas-cli/mas
synced 2024-11-25 04:50:24 +00:00
🧹 Lint
This commit is contained in:
parent
5df8db3fd6
commit
e65365d25f
6 changed files with 23 additions and 24 deletions
|
@ -10,6 +10,7 @@
|
||||||
# Disabled rules
|
# Disabled rules
|
||||||
--disable blankLinesAroundMark
|
--disable blankLinesAroundMark
|
||||||
--disable consecutiveSpaces
|
--disable consecutiveSpaces
|
||||||
|
--disable hoistPatternLet
|
||||||
--disable indent
|
--disable indent
|
||||||
|
|
||||||
# Enabled rules (disabled by default)
|
# Enabled rules (disabled by default)
|
||||||
|
|
|
@ -19,23 +19,21 @@ public struct ResetCommand: CommandProtocol {
|
||||||
|
|
||||||
/// Runs the command.
|
/// Runs the command.
|
||||||
public func run(_ options: Options) -> Result<Void, MASError> {
|
public func run(_ options: Options) -> Result<Void, MASError> {
|
||||||
/*
|
// The "Reset Application" command in the Mac App Store debug menu performs
|
||||||
The "Reset Application" command in the Mac App Store debug menu performs
|
// the following steps
|
||||||
the following steps
|
//
|
||||||
|
// - killall Dock
|
||||||
- killall Dock
|
// - killall storeagent (storeagent no longer exists)
|
||||||
- killall storeagent (storeagent no longer exists)
|
// - rm com.apple.appstore download directory
|
||||||
- rm com.apple.appstore download directory
|
// - clear cookies (appears to be a no-op)
|
||||||
- clear cookies (appears to be a no-op)
|
//
|
||||||
|
// As storeagent no longer exists we will implement a slight variant and kill all
|
||||||
As storeagent no longer exists we will implement a slight variant and kill all
|
// App Store-associated processes
|
||||||
App Store-associated processes
|
// - storeaccountd
|
||||||
- storeaccountd
|
// - storeassetd
|
||||||
- storeassetd
|
// - storedownloadd
|
||||||
- storedownloadd
|
// - storeinstalld
|
||||||
- storeinstalld
|
// - storelegacy
|
||||||
- storelegacy
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Kill processes
|
// Kill processes
|
||||||
let killProcs = [
|
let killProcs = [
|
||||||
|
|
|
@ -28,7 +28,7 @@ extension StoreSearch {
|
||||||
/// - Parameter appName: Name of app to find.
|
/// - Parameter appName: Name of app to find.
|
||||||
/// - Returns: String URL for the search service or nil if appName can't be encoded.
|
/// - Returns: String URL for the search service or nil if appName can't be encoded.
|
||||||
func searchURLString(forApp appName: String) -> String? {
|
func searchURLString(forApp appName: String) -> String? {
|
||||||
if let urlEncodedAppName = appName.URLEncodedString {
|
if let urlEncodedAppName = appName.urlEncodedString {
|
||||||
return "https://itunes.apple.com/search?media=software&entity=macSoftware&term=\(urlEncodedAppName)"
|
return "https://itunes.apple.com/search?media=software&entity=macSoftware&term=\(urlEncodedAppName)"
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -46,7 +46,7 @@ extension MASError: CustomStringConvertible {
|
||||||
https://github.com/mas-cli/mas/issues/164
|
https://github.com/mas-cli/mas/issues/164
|
||||||
"""
|
"""
|
||||||
|
|
||||||
case let .signInFailed(error):
|
case .signInFailed(let error):
|
||||||
if let error = error {
|
if let error = error {
|
||||||
return "Sign in failed: \(error.localizedDescription)"
|
return "Sign in failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,14 +56,14 @@ extension MASError: CustomStringConvertible {
|
||||||
case .alreadySignedIn:
|
case .alreadySignedIn:
|
||||||
return "Already signed in"
|
return "Already signed in"
|
||||||
|
|
||||||
case let .purchaseFailed(error):
|
case .purchaseFailed(let error):
|
||||||
if let error = error {
|
if let error = error {
|
||||||
return "Download request failed: \(error.localizedDescription)"
|
return "Download request failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
return "Download request failed"
|
return "Download request failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
case let .downloadFailed(error):
|
case .downloadFailed(let error):
|
||||||
if let error = error {
|
if let error = error {
|
||||||
return "Download failed: \(error.localizedDescription)"
|
return "Download failed: \(error.localizedDescription)"
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Foundation
|
||||||
|
|
||||||
extension String {
|
extension String {
|
||||||
/// Return an URL encoded string
|
/// Return an URL encoded string
|
||||||
public var URLEncodedString: String? {
|
public var urlEncodedString: String? {
|
||||||
addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@ enum NetworkResult {
|
||||||
extension NetworkResult: Equatable {
|
extension NetworkResult: Equatable {
|
||||||
static func == (lhs: NetworkResult, rhs: NetworkResult) -> Bool {
|
static func == (lhs: NetworkResult, rhs: NetworkResult) -> Bool {
|
||||||
switch (lhs, rhs) {
|
switch (lhs, rhs) {
|
||||||
case let (.success(data1), .success(data2)):
|
case (.success(let data1), .success(let data2)):
|
||||||
return data1 == data2
|
return data1 == data2
|
||||||
|
|
||||||
case let (.failure(error1), .failure(error2)):
|
case (.failure(let error1), .failure(let error2)):
|
||||||
return error1.localizedDescription == error2.localizedDescription
|
return error1.localizedDescription == error2.localizedDescription
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue