refactor(terminal): extract duplicated AppleScript patterns#617
Merged
Conversation
Add high-level helpers (spawn_via_applescript, close_via_applescript, focus_via_applescript, hide_via_applescript) that combine template substitution with osascript execution, reducing boilerplate in iTerm and Terminal.app backends. Move window ID validation into a default close_window trait method that delegates to a new close_window_by_id required method, removing require_window_id duplication from all four backends. Closes #436
- Fix stale doc in platform_unsupported! macro (close_window → close_window_by_id) - Add non-macOS stubs for high-level AppleScript helpers to match low-level pattern - Update close_window_by_id doc to include Alacritty alongside Ghostty - Update CLAUDE.md trait snippet to reflect new close_window_by_id and defaults
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
spawn_via_applescript,close_via_applescript,focus_via_applescript,hide_via_applescript) incommon/applescript.rsclose_windowtrait method that validates window ID then delegates to new requiredclose_window_by_id, removingrequire_window_idboilerplate from all four backendsTest plan
cargo fmt --checkpassescargo clippy --all -- -D warningspassescargo test --allpasses (127 terminal tests, 3 pre-existing unrelated failures inresolve_self_branch)Closes #436