Skip to content

Commit

Permalink
Use stringVar(p) instead of manually populating variables
Browse files Browse the repository at this point in the history
  • Loading branch information
hedge-sparrow committed Oct 16, 2024
1 parent bce4efd commit 91d1150
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions cli/cmd/customer_download_license.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,13 @@ You must specify the customer using either their name or ID with the --customer
# Download license for a customer in a specific app (if you have multiple apps)
replicated customer download-license --app myapp --customer "Acme Inc" --output license.yaml`,
RunE: func(cmd *cobra.Command, args []string) (err error) {

if customer, err = cmd.Flags().GetString("customer"); err != nil {
return err
}

if output, err = cmd.Flags().GetString("output"); err != nil {
return err
}

return r.downloadCustomerLicense(cmd, customer, output)
},
SilenceUsage: true,
}
parent.AddCommand(cmd)
cmd.Flags().String("customer", "", "The Customer Name or ID")
cmd.Flags().StringP("output", "o", "-", "Path to output license to. Defaults to stdout")
cmd.Flags().StringVar(&customer, "customer", "", "The Customer Name or ID")
cmd.Flags().StringVarP(&output, "output", "o", "-", "Path to output license to. Defaults to stdout")
cmd.MarkFlagRequired("customer")

return cmd
Expand Down

0 comments on commit 91d1150

Please sign in to comment.