From 5c91857e6597cc2111d5d87a35b3760e251cacf3 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Thu, 26 Sep 2024 20:08:44 -0400 Subject: [PATCH] Fallback to asking for handle in `plural cd clusters reinstall` (#552) The helpdoc also needed updating, but this should make the command more discoverable. --- cmd/command/cd/cd_clusters.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/cmd/command/cd/cd_clusters.go b/cmd/command/cd/cd_clusters.go index 2189fd5d..3b0fcdbb 100644 --- a/cmd/command/cd/cd_clusters.go +++ b/cmd/command/cd/cd_clusters.go @@ -113,7 +113,8 @@ func (p *Plural) cdClusterCommands() []cli.Command { Flags: []cli.Flag{ cli.StringFlag{Name: "values", Usage: "values file to use for the deployment agent helm chart", Required: false}, }, - Usage: "reinstalls the deployment operator into a cluster", + Usage: "reinstalls the deployment operator into a cluster", + ArgsUsage: "@{cluster-handle}", }, } } @@ -396,7 +397,16 @@ func (p *Plural) handleClusterReinstall(c *cli.Context) error { return err } - id, name := common.GetIdAndName(c.Args().Get(0)) + handle := c.Args().Get(0) + var err error + if handle == "" { + handle, err = utils.ReadLine("Enter the handle for the cluster you want to reinstall the agent in") + if err != nil { + return err + } + } + + id, name := common.GetIdAndName(handle) return p.ReinstallOperator(c, id, name) }