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
if [[ -n "$GHOSTTY_SSH_INTEGRATION" && "$GHOSTTY_SSH_INTEGRATION" != "off" ]]; then
if [[ -n "$GHOSTTY_SSH_INTEGRATION" ]]; then
# Wrap `ssh` command to provide Ghostty SSH integration.
#
# This approach supports wrapping an `ssh` alias, but the alias definition

View File

@ -99,7 +99,7 @@
}
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) {
ssh-term-only $@args
} elif (eq "basic" $E:GHOSTTY_SSH_INTEGRATION) {
@ -195,7 +195,7 @@
}
# 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~
}

View File

@ -87,7 +87,7 @@ function __ghostty_setup --on-event fish_prompt -d "Setup ghostty integration"
end
# 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"
switch "$GHOSTTY_SSH_INTEGRATION"
case term-only

View File

@ -245,7 +245,7 @@ _ghostty_deferred_init() {
fi
# 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
ssh() {
case "$GHOSTTY_SSH_INTEGRATION" in