Skip to content

Commit 99012d2

Browse files
committed
ssh kitten: Allow configuring the ssh kitten to skip some hosts via a new delegate config directive
1 parent 707cefd commit 99012d2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ Detailed list of changes
7171

7272
- ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully (:iss:`6254`)
7373

74+
- ssh kitten: Allow configuring the ssh kitten to skip some hosts via a new ``delegate`` config directive
75+
7476
- Graphics: Move images up along with text when the window is shrunk vertically (:iss:`6278`)
7577

7678
- Fix a regression in 0.28.0 that caused a buffer overflow when clearing the screen (:iss:`6306`, :pull:`6308`)

kittens/ssh/main.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"kitty/tools/tui/loop"
3333
"kitty/tools/utils"
3434
"kitty/tools/utils/secrets"
35+
"kitty/tools/utils/shlex"
3536
"kitty/tools/utils/shm"
3637

3738
"golang.org/x/exp/maps"
@@ -613,6 +614,13 @@ func run_ssh(ssh_args, server_args, found_extra_args []string) (rc int, err erro
613614
fmt.Fprintf(os.Stderr, "Ignoring bad config line: %s:%d with error: %s", filepath.Base(x.Src_file), x.Line_number, x.Err)
614615
}
615616
}
617+
if host_opts.Delegate != "" {
618+
delegate_cmd, err := shlex.Split(host_opts.Delegate)
619+
if err != nil {
620+
return 1, fmt.Errorf("Could not parse delegate command: %#v with error: %w", host_opts.Delegate, err)
621+
}
622+
return 1, unix.Exec(utils.FindExe(delegate_cmd[0]), utils.Concat(delegate_cmd, ssh_args, server_args), os.Environ())
623+
}
616624
if host_opts.Share_connections {
617625
kpid, err := strconv.Atoi(os.Getenv("KITTY_PID"))
618626
if err != nil {

kittens/ssh/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ def option_text() -> str:
201201
terminal to send data without an extra roundtrip, adding to initial connection
202202
latency.
203203
''')
204+
205+
opt('delegate', '', long_text='''
206+
Do not use the SSH kitten for this host. Instead run the command specified as the delegate.
207+
For example using :code:`delegate ssh` will run the ssh command with all arguments passed
208+
to the kitten, except kitten specific ones. This is useful if some hosts are not capable
209+
of supporting the ssh kitten.
210+
''')
204211
egr() # }}}
205212

206213

0 commit comments

Comments
 (0)