From 4fba9e6caaf98c128179cce3e8be26543c1a066d Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Mon, 20 Jan 2025 19:49:43 -0800 Subject: [PATCH] Default to current connection for `wsh conn reinstall` (#1782) --- cmd/wsh/cmd/wshcmd-conn.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/wsh/cmd/wshcmd-conn.go b/cmd/wsh/cmd/wshcmd-conn.go index 2b2d3a98f..b0a6cd352 100644 --- a/cmd/wsh/cmd/wshcmd-conn.go +++ b/cmd/wsh/cmd/wshcmd-conn.go @@ -30,7 +30,6 @@ var connStatusCmd = &cobra.Command{ var connReinstallCmd = &cobra.Command{ Use: "reinstall CONNECTION", Short: "reinstall wsh on a connection", - Args: cobra.ExactArgs(1), RunE: connReinstallRun, PreRunE: preRunSetupRpcClient, } @@ -124,6 +123,12 @@ func connStatusRun(cmd *cobra.Command, args []string) error { } func connReinstallRun(cmd *cobra.Command, args []string) error { + if len(args) != 1 { + if RpcContext.Conn == "" { + return fmt.Errorf("no connection specified") + } + args = []string{RpcContext.Conn} + } connName := args[0] if err := validateConnectionName(connName); err != nil { return err