Start work on porting the SSH kitten to Go
This commit is contained in:
parent
3d3bfe6c75
commit
6f63d9c5d4
@ -329,6 +329,7 @@ def kitten_clis() -> None:
|
|||||||
print('func create_cmd(root *cli.Command, run_func func(*cli.Command, *Options, []string)(int, error)) {')
|
print('func create_cmd(root *cli.Command, run_func func(*cli.Command, *Options, []string)(int, error)) {')
|
||||||
print('ans := root.AddSubCommand(&cli.Command{')
|
print('ans := root.AddSubCommand(&cli.Command{')
|
||||||
print(f'Name: "{kitten}",')
|
print(f'Name: "{kitten}",')
|
||||||
|
if kcd:
|
||||||
print(f'ShortDescription: "{serialize_as_go_string(kcd["short_desc"])}",')
|
print(f'ShortDescription: "{serialize_as_go_string(kcd["short_desc"])}",')
|
||||||
if kcd['usage']:
|
if kcd['usage']:
|
||||||
print(f'Usage: "[options] {serialize_as_go_string(kcd["usage"])}",')
|
print(f'Usage: "[options] {serialize_as_go_string(kcd["usage"])}",')
|
||||||
@ -351,6 +352,8 @@ def kitten_clis() -> None:
|
|||||||
print("clone := root.AddClone(ans.Group, ans)")
|
print("clone := root.AddClone(ans.Group, ans)")
|
||||||
print('clone.Hidden = false')
|
print('clone.Hidden = false')
|
||||||
print(f'clone.Name = "{serialize_as_go_string(kitten.replace("_", "-"))}"')
|
print(f'clone.Name = "{serialize_as_go_string(kitten.replace("_", "-"))}"')
|
||||||
|
if not kcd:
|
||||||
|
print('specialize_command(ans)')
|
||||||
print('}')
|
print('}')
|
||||||
print('type Options struct {')
|
print('type Options struct {')
|
||||||
print('\n'.join(od))
|
print('\n'.join(od))
|
||||||
|
|||||||
@ -24,7 +24,7 @@ exec_kitty() {
|
|||||||
|
|
||||||
|
|
||||||
is_wrapped_kitten() {
|
is_wrapped_kitten() {
|
||||||
wrapped_kittens="clipboard icat unicode_input"
|
wrapped_kittens="clipboard icat unicode_input ssh"
|
||||||
[ -n "$1" ] && {
|
[ -n "$1" ] && {
|
||||||
case " $wrapped_kittens " in
|
case " $wrapped_kittens " in
|
||||||
*" $1 "*) printf "%s" "$1" ;;
|
*" $1 "*) printf "%s" "$1" ;;
|
||||||
|
|||||||
25
tools/cmd/ssh/main.go
Normal file
25
tools/cmd/ssh/main.go
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// License: GPLv3 Copyright: 2023, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
package ssh
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"kitty/tools/cli"
|
||||||
|
)
|
||||||
|
|
||||||
|
var _ = fmt.Print
|
||||||
|
|
||||||
|
func main(cmd *cli.Command, o *Options, args []string) (rc int, err error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func EntryPoint(parent *cli.Command) {
|
||||||
|
create_cmd(parent, main)
|
||||||
|
}
|
||||||
|
|
||||||
|
func specialize_command(ssh *cli.Command) {
|
||||||
|
ssh.Usage = "arguments for the ssh command"
|
||||||
|
ssh.ShortDescription = "Truly convenient SSH"
|
||||||
|
ssh.HelpText = "The ssh kitten is a thin wrapper around the ssh command. It automatically enables shell integration on the remote host, re-uses existing connections to reduce latency, makes the kitty terminfo database available, etc. It's invocation is identical to the ssh command. For details on its usage, see :doc:`/kittens/ssh`."
|
||||||
|
}
|
||||||
@ -10,6 +10,7 @@ import (
|
|||||||
"kitty/tools/cmd/clipboard"
|
"kitty/tools/cmd/clipboard"
|
||||||
"kitty/tools/cmd/edit_in_kitty"
|
"kitty/tools/cmd/edit_in_kitty"
|
||||||
"kitty/tools/cmd/icat"
|
"kitty/tools/cmd/icat"
|
||||||
|
"kitty/tools/cmd/ssh"
|
||||||
"kitty/tools/cmd/unicode_input"
|
"kitty/tools/cmd/unicode_input"
|
||||||
"kitty/tools/cmd/update_self"
|
"kitty/tools/cmd/update_self"
|
||||||
"kitty/tools/tui"
|
"kitty/tools/tui"
|
||||||
@ -30,6 +31,8 @@ func KittyToolEntryPoints(root *cli.Command) {
|
|||||||
clipboard.EntryPoint(root)
|
clipboard.EntryPoint(root)
|
||||||
// icat
|
// icat
|
||||||
icat.EntryPoint(root)
|
icat.EntryPoint(root)
|
||||||
|
// ssh
|
||||||
|
ssh.EntryPoint(root)
|
||||||
// unicode_input
|
// unicode_input
|
||||||
unicode_input.EntryPoint(root)
|
unicode_input.EntryPoint(root)
|
||||||
// __hold_till_enter__
|
// __hold_till_enter__
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user