diff --git a/docs/changelog.rst b/docs/changelog.rst index 94fd0e82e..d2422a2ae 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -71,6 +71,8 @@ Detailed list of changes - ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully (:iss:`6254`) +- ssh kitten: Allow configuring the ssh kitten to skip some hosts via a new ``delegate`` config directive + - Graphics: Move images up along with text when the window is shrunk vertically (:iss:`6278`) - Fix a regression in 0.28.0 that caused a buffer overflow when clearing the screen (:iss:`6306`, :pull:`6308`) diff --git a/kittens/ssh/main.go b/kittens/ssh/main.go index a6c209a4c..f0e478c26 100644 --- a/kittens/ssh/main.go +++ b/kittens/ssh/main.go @@ -32,6 +32,7 @@ import ( "kitty/tools/tui/loop" "kitty/tools/utils" "kitty/tools/utils/secrets" + "kitty/tools/utils/shlex" "kitty/tools/utils/shm" "golang.org/x/exp/maps" @@ -613,6 +614,13 @@ func run_ssh(ssh_args, server_args, found_extra_args []string) (rc int, err erro fmt.Fprintf(os.Stderr, "Ignoring bad config line: %s:%d with error: %s", filepath.Base(x.Src_file), x.Line_number, x.Err) } } + if host_opts.Delegate != "" { + delegate_cmd, err := shlex.Split(host_opts.Delegate) + if err != nil { + return 1, fmt.Errorf("Could not parse delegate command: %#v with error: %w", host_opts.Delegate, err) + } + return 1, unix.Exec(utils.FindExe(delegate_cmd[0]), utils.Concat(delegate_cmd, ssh_args, server_args), os.Environ()) + } if host_opts.Share_connections { kpid, err := strconv.Atoi(os.Getenv("KITTY_PID")) if err != nil { diff --git a/kittens/ssh/main.py b/kittens/ssh/main.py index 70b101a48..a6b17039d 100644 --- a/kittens/ssh/main.py +++ b/kittens/ssh/main.py @@ -201,6 +201,13 @@ terminal before the connection is established, so the kitten cannot use the terminal to send data without an extra roundtrip, adding to initial connection latency. ''') + +opt('delegate', '', long_text=''' +Do not use the SSH kitten for this host. Instead run the command specified as the delegate. +For example using :code:`delegate ssh` will run the ssh command with all arguments passed +to the kitten, except kitten specific ones. This is useful if some hosts are not capable +of supporting the ssh kitten. +''') egr() # }}}