mirror of
https://github.com/samsonjs/Peekaboo.git
synced 2026-04-27 15:07:41 +00:00
style: Apply SwiftFormat formatting
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
141502d668
commit
9837e7bea8
4 changed files with 32 additions and 30 deletions
|
|
@ -250,11 +250,12 @@ struct ImageCommand: ParsableCommand {
|
||||||
let targetApp: NSRunningApplication
|
let targetApp: NSRunningApplication
|
||||||
do {
|
do {
|
||||||
targetApp = try ApplicationFinder.findApplication(identifier: appIdentifier)
|
targetApp = try ApplicationFinder.findApplication(identifier: appIdentifier)
|
||||||
} catch ApplicationError.notFound(let identifier) {
|
} catch let ApplicationError.notFound(identifier) {
|
||||||
throw CaptureError.appNotFound(identifier)
|
throw CaptureError.appNotFound(identifier)
|
||||||
} catch ApplicationError.ambiguous(let identifier, let matches) {
|
} catch let ApplicationError.ambiguous(identifier, matches) {
|
||||||
let appNames = matches.map { $0.localizedName ?? $0.bundleIdentifier ?? "Unknown" }
|
let appNames = matches.map { $0.localizedName ?? $0.bundleIdentifier ?? "Unknown" }
|
||||||
throw CaptureError.unknownError("Multiple applications match '\(identifier)': \(appNames.joined(separator: ", "))")
|
throw CaptureError
|
||||||
|
.unknownError("Multiple applications match '\(identifier)': \(appNames.joined(separator: ", "))")
|
||||||
}
|
}
|
||||||
|
|
||||||
if captureFocus == .foreground || (captureFocus == .auto && !targetApp.isActive) {
|
if captureFocus == .foreground || (captureFocus == .auto && !targetApp.isActive) {
|
||||||
|
|
@ -304,11 +305,12 @@ struct ImageCommand: ParsableCommand {
|
||||||
let targetApp: NSRunningApplication
|
let targetApp: NSRunningApplication
|
||||||
do {
|
do {
|
||||||
targetApp = try ApplicationFinder.findApplication(identifier: appIdentifier)
|
targetApp = try ApplicationFinder.findApplication(identifier: appIdentifier)
|
||||||
} catch ApplicationError.notFound(let identifier) {
|
} catch let ApplicationError.notFound(identifier) {
|
||||||
throw CaptureError.appNotFound(identifier)
|
throw CaptureError.appNotFound(identifier)
|
||||||
} catch ApplicationError.ambiguous(let identifier, let matches) {
|
} catch let ApplicationError.ambiguous(identifier, matches) {
|
||||||
let appNames = matches.map { $0.localizedName ?? $0.bundleIdentifier ?? "Unknown" }
|
let appNames = matches.map { $0.localizedName ?? $0.bundleIdentifier ?? "Unknown" }
|
||||||
throw CaptureError.unknownError("Multiple applications match '\(identifier)': \(appNames.joined(separator: ", "))")
|
throw CaptureError
|
||||||
|
.unknownError("Multiple applications match '\(identifier)': \(appNames.joined(separator: ", "))")
|
||||||
}
|
}
|
||||||
|
|
||||||
if captureFocus == .foreground || (captureFocus == .auto && !targetApp.isActive) {
|
if captureFocus == .foreground || (captureFocus == .auto && !targetApp.isActive) {
|
||||||
|
|
@ -507,7 +509,7 @@ struct ImageCommand: ParsableCommand {
|
||||||
|
|
||||||
// Only consider it a permission error if it mentions both "permission" and capture-related terms
|
// Only consider it a permission error if it mentions both "permission" and capture-related terms
|
||||||
if errorString.contains("permission") &&
|
if errorString.contains("permission") &&
|
||||||
(errorString.contains("capture") || errorString.contains("recording") || errorString.contains("screen")) {
|
(errorString.contains("capture") || errorString.contains("recording") || errorString.contains("screen")) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ struct AppsSubcommand: ParsableCommand {
|
||||||
Foundation.exit(captureError.exitCode)
|
Foundation.exit(captureError.exitCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func printApplicationList(_ applications: [ApplicationInfo]) {
|
func printApplicationList(_ applications: [ApplicationInfo]) {
|
||||||
let output = formatApplicationList(applications)
|
let output = formatApplicationList(applications)
|
||||||
print(output)
|
print(output)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal func formatApplicationList(_ applications: [ApplicationInfo]) -> String {
|
func formatApplicationList(_ applications: [ApplicationInfo]) -> String {
|
||||||
var output = "Running Applications (\(applications.count)):\n\n"
|
var output = "Running Applications (\(applications.count)):\n\n"
|
||||||
|
|
||||||
for (index, app) in applications.enumerated() {
|
for (index, app) in applications.enumerated() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue