mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-09-05 19:08:17 +00:00
macos: terminal not found should be an error
This commit is contained in:
@@ -30,13 +30,13 @@ struct GetTerminalDetailsIntent: AppIntent {
|
||||
case .title: return .result(value: terminal.title)
|
||||
case .workingDirectory: return .result(value: terminal.workingDirectory)
|
||||
case .allContents:
|
||||
guard let view = terminal.surfaceView else { return .result(value: nil) }
|
||||
guard let view = terminal.surfaceView else { throw GhosttyIntentError.surfaceNotFound }
|
||||
return .result(value: view.cachedScreenContents.get())
|
||||
case .selectedText:
|
||||
guard let view = terminal.surfaceView else { return .result(value: nil) }
|
||||
guard let view = terminal.surfaceView else { throw GhosttyIntentError.surfaceNotFound }
|
||||
return .result(value: view.accessibilitySelectedText())
|
||||
case .visibleText:
|
||||
guard let view = terminal.surfaceView else { return .result(value: nil) }
|
||||
guard let view = terminal.surfaceView else { throw GhosttyIntentError.surfaceNotFound }
|
||||
return .result(value: view.cachedVisibleContents.get())
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
enum GhosttyIntentError: Error, CustomLocalizedStringResourceConvertible {
|
||||
case appUnavailable
|
||||
case surfaceNotFound
|
||||
|
||||
var localizedStringResource: LocalizedStringResource {
|
||||
switch self {
|
||||
case .appUnavailable: return "The Ghostty app isn't properly initialized."
|
||||
case .surfaceNotFound: return "The terminal no longer exists."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user