Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# .markdownlint-cli2.yaml
# mas
#
# markdownlint-cli2 0.21.0 / markdownlint 0.40.0
# markdownlint-cli2 0.22.0 / markdownlint 0.40.0
#
---
gitignore: true
Expand Down
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#--enable markTypes
#--enable preferExplicitFalse
#--enable testSuiteAccessControl
#--enable wrapMultilineConditionalAssignment

# Enabled rules (disabled by default)
--enable acronyms
Expand All @@ -34,7 +35,6 @@
--enable validateTestCases
--enable wrapConditionalBodies
--enable wrapEnumCases
--enable wrapMultilineConditionalAssignment
--enable wrapMultilineFunctionChains
--enable wrapSwitchCases

Expand Down
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ disabled_rules:
- strict_fileprivate
- type_body_length
attributes:
always_on_line_above: ['@Flag', '@MainActor', '@OptionGroup']
always_on_line_above: ['@Flag', '@MainActor', '@OptionGroup', '@TaskLocal']
deployment_target:
macOS_deployment_target: 13
macOSApplicationExtension_deployment_target: 13
Expand Down
6 changes: 3 additions & 3 deletions Brewfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
brew "actionlint" # 1.7.11
brew "gh" # 2.87.3
brew "gh" # 2.88.1
brew "git" # 2.53.0
brew "ipsw" # 3.1.660
brew "markdownlint-cli2" # 0.21.0
brew "ipsw" # 3.1.665
brew "markdownlint-cli2" # 0.22.0
brew "periphery" if MacOS.version >= :sequoia && `/usr/bin/arch` == "arm64" # 3.6.0
brew "shellcheck" # 0.11.0
brew "swiftformat" # 0.60.1
Expand Down
2 changes: 1 addition & 1 deletion Documentation/Sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class Sample {
}

/// Use `()` for void arguments & `Void` for void return types.
let closure: () -> Void = {
func x(_: () -> Void) {
// Do nothing
}

Expand Down
12 changes: 6 additions & 6 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ _ = Package(
products: [.executable(name: "mas", targets: ["mas"])],
dependencies: [
.package(url: "https://github.com/KittyMac/Sextant.git", from: "0.4.38"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.7.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.7.1"),
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.3.0"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.4.0"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.4.1"),
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.7.0"),
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.13.0"),
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.13.2"),
],
targets: [
.plugin(name: "MASBuildToolPlugin", capability: .buildTool()),
Expand Down
2 changes: 1 addition & 1 deletion Scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ shellcheck -s bash -o all -e SC1009,SC1088,SC2296,SC2298,SC2299,SC2300,SC2301,SC
printf -- $'--> 🚷 Non-Executables\n'
readonly -a non_executables=(Scripts/***/*(N.^f+111))
if (("${#non_executables[@]}")); then
printf $'%s\n' "${non_executables[@]}"
printf $'\e[1;91m%s\e[0m\n' "${non_executables[@]}"
((exit_status |= 1))
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.660, BuildCommit: Homebrew)
// Generated by https://github.com/blacktop/ipsw (Version: 3.1.665, BuildCommit: Homebrew)
//
// - LC_BUILD_VERSION: Platform: macOS, MinOS: 26.2, SDK: 26.2, Tool: ld (1230.3)
// - LC_SOURCE_VERSION: 716.2.2.0.0
Expand Down
26 changes: 13 additions & 13 deletions Sources/mas/AppStore/AppStoreAction+download.swift
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver {
return
}
guard let continuation = unsafe continuation else {
MAS.printer.error("Failed to obtain download continuation for ADAM ID \(adamID)")
MAS.printer.error("Failed to get download continuation for ADAM ID \(adamID)")
return
}

Expand Down Expand Up @@ -204,7 +204,8 @@ private actor DownloadQueueObserver: CKDownloadQueueObserver {
case
.downloading where prevPhaseType == .processing,
.downloaded where prevPhaseType == .downloading,
.performing:
.performing
: // swiftformat:disable:this indent
MAS.printer.clearCurrentLine(of: .standardOutput)
MAS.printer.notice(snapshot.activePhaseType, snapshot.appNameAndVersion)
default:
Expand Down Expand Up @@ -469,17 +470,16 @@ private enum PhaseType: Equatable { // swiftlint:disable:this one_declaration_pe
}

init(_ action: AppStoreAction, rawValue: Int64?) {
self =
switch rawValue {
case 0:
.downloading
case 1:
.performing(action)
case 5:
.downloaded
default:
.processing
}
self = switch rawValue {
case 0:
.downloading
case 1:
.performing(action)
case 5:
.downloaded
default:
.processing
}
}
}

Expand Down
13 changes: 2 additions & 11 deletions Sources/mas/AppStore/AppStoreAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,8 @@ enum AppStoreAction {
}
}

func apps(
withAppIDs appIDs: [AppID],
force: Bool,
installedApps: [InstalledApp],
lookupAppFromAppID: @escaping @Sendable (AppID) async throws -> CatalogApp,
) async throws {
try await apps(
withADAMIDs: await appIDs.lookupCatalogApps(using: lookupAppFromAppID).map(\.adamID),
force: force,
installedApps: installedApps,
)
func apps(withAppIDs appIDs: [AppID], force: Bool, installedApps: [InstalledApp]) async throws {
try await apps(withADAMIDs: await appIDs.catalogApps.map(\.adamID), force: force, installedApps: installedApps)
}

func apps(withADAMIDs adamIDs: [ADAMID], force: Bool, installedApps: [InstalledApp]) async throws {
Expand Down
2 changes: 1 addition & 1 deletion Sources/mas/Commands/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ extension MAS {
private var runningSliceArchitecture: String {
var info = utsname()
return unsafe uname(&info) == 0
? withUnsafePointer(to: &info.machine) { pointer in // swiftformat:disable indent
? unsafe withUnsafePointer(to: &info.machine) { pointer in // swiftformat:disable indent
unsafe pointer.withMemoryRebound(
to: CChar.self,
capacity: unsafe MemoryLayout.size(ofValue: unsafe pointer),
Expand Down
1 change: 0 additions & 1 deletion Sources/mas/Commands/Get.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ extension MAS {
withAppIDs: catalogAppIDsOptionGroup.appIDs,
force: forceOptionGroup.force,
installedApps: try await installedApps,
lookupAppFromAppID: lookup(appID:),
)
}
}
Expand Down
10 changes: 3 additions & 7 deletions Sources/mas/Commands/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,14 @@ extension MAS {
private var catalogAppIDsOptionGroup: CatalogAppIDsOptionGroup

func run() async {
await run(lookupAppFromAppID: lookup(appID:))
await run(catalogApps: await catalogAppIDsOptionGroup.appIDs.catalogApps)
}

private func run(lookupAppFromAppID: @escaping @Sendable (AppID) async throws -> CatalogApp) async {
await run(catalogApps: await catalogAppIDsOptionGroup.appIDs.lookupCatalogApps(using: lookupAppFromAppID))
}

func run(catalogApps: [CatalogApp]) async { // swiftformat:disable:this organizeDeclarations
func run(catalogApps: [CatalogApp]) async {
await run(appStorePageURLStrings: catalogApps.map(\.appStorePageURLString))
}

private func run(appStorePageURLStrings: [String]) async { // swiftformat:disable:this organizeDeclarations
private func run(appStorePageURLStrings: [String]) async {
await appStorePageURLStrings.forEach(attemptTo: "open") { appStorePageURLString in
guard let url = URL(string: appStorePageURLString) else {
throw MASError.unparsableURL(appStorePageURLString)
Expand Down
1 change: 0 additions & 1 deletion Sources/mas/Commands/Install.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ extension MAS {
withAppIDs: catalogAppIDsOptionGroup.appIDs,
force: forceOptionGroup.force,
installedApps: try await installedApps,
lookupAppFromAppID: lookup(appID:),
)
}
}
Expand Down
8 changes: 2 additions & 6 deletions Sources/mas/Commands/Lookup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ extension MAS {
private var catalogAppIDsOptionGroup: CatalogAppIDsOptionGroup

func run() async {
await run(lookupAppFromAppID: lookup(appID:))
run(catalogApps: await catalogAppIDsOptionGroup.appIDs.catalogApps)
}

private func run(lookupAppFromAppID: @escaping @Sendable (AppID) async throws -> CatalogApp) async {
run(catalogApps: await catalogAppIDsOptionGroup.appIDs.lookupCatalogApps(using: lookupAppFromAppID))
}

func run(catalogApps: [CatalogApp]) { // swiftformat:disable:this organizeDeclarations
func run(catalogApps: [CatalogApp]) {
printer.info(
catalogApps.map { catalogApp in
"""
Expand Down
9 changes: 3 additions & 6 deletions Sources/mas/Commands/Lucky.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@ extension MAS {
private var searchTermOptionGroup: SearchTermOptionGroup

func run() async throws {
try await run(installedApps: try await installedApps, searchForAppsMatchingSearchTerm: search(for:))
try await run(installedApps: try await installedApps)
}

private func run(
installedApps: [InstalledApp],
searchForAppsMatchingSearchTerm: (String) async throws -> [CatalogApp],
) async throws {
private func run(installedApps: [InstalledApp]) async throws {
let searchTerm = searchTermOptionGroup.searchTerm
guard let adamID = try await searchForAppsMatchingSearchTerm(searchTerm).first?.adamID else {
guard let adamID = try await Dependencies.current.searchForAppsMatchingSearchTerm(searchTerm).first?.adamID else {
throw MASError.noCatalogAppsFound(for: searchTerm)
}

Expand Down
23 changes: 7 additions & 16 deletions Sources/mas/Commands/Open.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ extension MAS {
private var appIDString: String?

func run() async throws {
try await run(lookupAppFromAppID: lookup(appID:))
}

private func run(lookupAppFromAppID: (AppID) async throws -> CatalogApp) async throws {
try await run(appStorePageURLString: appStorePageURLString(lookupAppFromAppID: lookupAppFromAppID))
try await run(
appStorePageURLString: appIDString.map { appIDString in
try await Dependencies.current // swiftformat:disable:next indent
.lookupAppFromAppID(AppID(from: appIDString, forceBundleID: forceBundleIDOptionGroup.forceBundleID))
.appStorePageURLString // swiftformat:disable:this indent
},
)
}

private func run(appStorePageURLString: String?) async throws {
Expand All @@ -43,17 +45,6 @@ extension MAS {

try await openMacAppStorePage(forAppStorePageURLString: appStorePageURLString)
}

private func appStorePageURLString(lookupAppFromAppID: (AppID) async throws -> CatalogApp) async throws -> String? {
guard let appIDString else {
return nil
}

return try await lookupAppFromAppID(
AppID(from: appIDString, forceBundleID: forceBundleIDOptionGroup.forceBundleID),
)
.appStorePageURLString
}
}
}

Expand Down
Loading
Loading