refactor: simplify ssh integration environment variable checks

This commit is contained in:
Jason Rayne
2025-06-16 09:53:22 -07:00
parent 34af3ffbaf
commit 2babdb458f
4 changed files with 5 additions and 5 deletions

View File

@ -103,7 +103,7 @@ if [[ "$GHOSTTY_SHELL_FEATURES" == *"sudo"* && -n "$TERMINFO" ]]; then
} }
fi fi
if [[ -n "$GHOSTTY_SSH_INTEGRATION" && "$GHOSTTY_SSH_INTEGRATION" != "off" ]]; then if [[ -n "$GHOSTTY_SSH_INTEGRATION" ]]; then
# Wrap `ssh` command to provide Ghostty SSH integration. # Wrap `ssh` command to provide Ghostty SSH integration.
# #
# This approach supports wrapping an `ssh` alias, but the alias definition # This approach supports wrapping an `ssh` alias, but the alias definition

View File

@ -99,7 +99,7 @@
} }
fn ssh-with-ghostty-integration {|@args| fn ssh-with-ghostty-integration {|@args|
if (and (has-env GHOSTTY_SSH_INTEGRATION) (not-eq "" $E:GHOSTTY_SSH_INTEGRATION) (not-eq "off" $E:GHOSTTY_SSH_INTEGRATION)) { if (has-env GHOSTTY_SSH_INTEGRATION) {
if (eq "term-only" $E:GHOSTTY_SSH_INTEGRATION) { if (eq "term-only" $E:GHOSTTY_SSH_INTEGRATION) {
ssh-term-only $@args ssh-term-only $@args
} elif (eq "basic" $E:GHOSTTY_SSH_INTEGRATION) { } elif (eq "basic" $E:GHOSTTY_SSH_INTEGRATION) {
@ -195,7 +195,7 @@
} }
# Register SSH integration if enabled # Register SSH integration if enabled
if (and (has-env GHOSTTY_SSH_INTEGRATION) (not-eq "" $E:GHOSTTY_SSH_INTEGRATION) (not-eq "off" $E:GHOSTTY_SSH_INTEGRATION) (has-external ssh)) { if (and (has-env GHOSTTY_SSH_INTEGRATION) (has-external ssh)) {
edit:add-var ssh~ $ssh-with-ghostty-integration~ edit:add-var ssh~ $ssh-with-ghostty-integration~
} }

View File

@ -87,7 +87,7 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
end end
# SSH integration wrapper # SSH integration wrapper
if test -n "$GHOSTTY_SSH_INTEGRATION"; and test "$GHOSTTY_SSH_INTEGRATION" != off if test -n "$GHOSTTY_SSH_INTEGRATION"
function ssh -d "Wrap ssh to provide Ghostty SSH integration" function ssh -d "Wrap ssh to provide Ghostty SSH integration"
switch "$GHOSTTY_SSH_INTEGRATION" switch "$GHOSTTY_SSH_INTEGRATION"
case term-only case term-only

View File

@ -245,7 +245,7 @@ _ghostty_deferred_init() {
fi fi
# SSH # SSH
if [[ -n "$GHOSTTY_SSH_INTEGRATION" && "$GHOSTTY_SSH_INTEGRATION" != "off" ]]; then if [[ -n "$GHOSTTY_SSH_INTEGRATION" ]]; then
# Wrap `ssh` command to provide Ghostty SSH integration # Wrap `ssh` command to provide Ghostty SSH integration
ssh() { ssh() {
case "$GHOSTTY_SSH_INTEGRATION" in case "$GHOSTTY_SSH_INTEGRATION" in