diff --git a/cmd/shell.go b/cmd/shell.go index 50936735..3c41f0ee 100644 --- a/cmd/shell.go +++ b/cmd/shell.go @@ -36,11 +36,9 @@ var shellCmd = &cobra.Command{ }, } var ( - command []string - podName *string - podContainerName *string - podNameFlag string - containerNameFlag string + command []string + podName string + podContainerName string ) func shellRequestWithoutArg() (*pkg.ShellRequest, error) { @@ -252,15 +250,8 @@ func shellRequestWithApplicationUrl(args []string) (*pkg.ShellRequest, error) { func init() { var shellCmd = shellCmd shellCmd.Flags().StringSliceVarP(&command, "command", "c", []string{"sh"}, "command to launch inside the pod") - shellCmd.Flags().StringVarP(&podNameFlag, "pod", "p", "", "pod name where to exec into") - shellCmd.Flags().StringVar(&containerNameFlag, "container", "", "container name inside the pod") - - if podNameFlag != "" { - podName = &podNameFlag - } - if containerNameFlag != "" { - podContainerName = &containerNameFlag - } + shellCmd.Flags().StringVarP(&podName, "pod", "p", "", "pod name where to exec into") + shellCmd.Flags().StringVar(&podContainerName, "container", "", "container name inside the pod") rootCmd.AddCommand(shellCmd) } diff --git a/pkg/shell.go b/pkg/shell.go index 439fd587..4c2827d4 100644 --- a/pkg/shell.go +++ b/pkg/shell.go @@ -20,8 +20,8 @@ type ShellRequest struct { ProjectID utils.Id `url:"project"` OrganizationID utils.Id `url:"organization"` ClusterID utils.Id `url:"cluster"` - PodName *string `url:"pod_name,omitempty"` - ContainerName *string `url:"container_name,omitempty"` + PodName string `url:"pod_name,omitempty"` + ContainerName string `url:"container_name,omitempty"` Command []string `url:"command"` } @@ -62,6 +62,7 @@ func ExecShell(req *ShellRequest) { func createWebsocketConn(req *ShellRequest) (*websocket.Conn, error) { command, err := query.Values(req) + println("", command.Encode(), req.PodName) if err != nil { return nil, err }