cli: add an ssh-wrapping +ssh action#12582
Open
jparise wants to merge 5 commits into
Open
Conversation
Add a drop-in `ssh` wrapper that sets up the remote environment for Ghostty. Anything not consumed as one of our own flags is forwarded to the real, wrapped `ssh` binary. It can be used directly (`ghostty +ssh user@host`), aliased (`alias ssh='ghostty +ssh --'`), or invoked through Ghostty's shell integration. Before exec'ing ssh, `+ssh`: - Forwards Ghostty environment to the remote (`--forward-env`): sets TERM=xterm-256color and requests SendEnv forwarding of COLORTERM, TERM_PROGRAM, and TERM_PROGRAM_VERSION. - Installs Ghostty's terminfo on the remote (`--terminfo`), informed by our existing `ssh-cache` system and using our internal xterm-ghostty terminfo representation. A third flag, `--cache`, controls cache use; `--cache=false` bypasses both read and write, which is useful for scripting and for debugging install failures without polluting the cache. For shell integration, this replaces the per-shell logic (which made up roughly a third of our shell integration scripts) with a simple wrapper function that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line. This commit only migrates the bash integration; the other shells will follow separately.
Replace the inline ssh integration with a thin wrapper that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line. The shell wrapper no longer carries terminfo install, ControlMaster wiring, or cache bookkeeping; it just maps the feature flags to flags on `+ssh` and forwards everything else.
Replace the inline ssh integration with a thin wrapper that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line.
Replace the inline ssh integration with a thin wrapper that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line.
Replace the inline ssh integration with a thin wrapper that translates GHOSTTY_SHELL_FEATURES into a `ghostty +ssh` command line. When no ssh-* feature is enabled, the wrapper falls through to the real `ssh` binary unchanged so nushell users without ssh integration get plain ssh behavior.
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.
Add a drop-in
sshwrapper that sets up the remote environment for Ghostty. Anything not consumed as one of our own flags is forwarded to the real, wrappedsshbinary. It can be used directly (ghostty +ssh user@host), aliased (alias ssh='ghostty +ssh --'), or invoked through Ghostty's shell integration.Before exec'ing ssh,
+ssh:--forward-env): sets TERM=xterm-256color and requests SendEnv forwarding of COLORTERM, TERM_PROGRAM, and TERM_PROGRAM_VERSION.--terminfo), informed by our existingssh-cachesystem and using our internal xterm-ghostty terminfo representation.A third flag,
--cache, controls cache use;--cache=falsebypasses both read and write, which is useful for scripting and for debugging install failures without polluting the cache.For shell integration, this replaces the per-shell logic (which made up roughly a third of our shell integration scripts) with a simple wrapper function that translates GHOSTTY_SHELL_FEATURES into a
ghostty +sshcommand line.