From 407555c6c8864d22a4f5cf0a433bc229f834b6ac Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 19 Feb 2023 20:50:58 +0530 Subject: [PATCH] Get completion working for kitten ssh --- tools/cli/command.go | 4 ++-- tools/cmd/ssh/main.go | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/cli/command.go b/tools/cli/command.go index ec213746f..07e62ba64 100644 --- a/tools/cli/command.go +++ b/tools/cli/command.go @@ -33,11 +33,11 @@ type Command struct { ArgCompleter CompletionFunc // Stop completion processing at this arg num StopCompletingAtArg int - // Consider all args as non-options args + // Consider all args as non-options args when parsing for completion OnlyArgsAllowed bool // Pass through all args, useful for wrapper commands IgnoreAllArgs bool - // Specialised arg aprsing + // Specialised arg parsing ParseArgsForCompletion func(cmd *Command, args []string, completions *Completions) SubCommandGroups []*CommandGroup diff --git a/tools/cmd/ssh/main.go b/tools/cmd/ssh/main.go index b23908571..fa6fb7b56 100644 --- a/tools/cmd/ssh/main.go +++ b/tools/cmd/ssh/main.go @@ -23,4 +23,6 @@ func specialize_command(ssh *cli.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`." ssh.IgnoreAllArgs = true + ssh.OnlyArgsAllowed = true + ssh.ArgCompleter = cli.CompletionForWrapper("ssh") }