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