Skip to content

Commit

Permalink
Upgrade cobra and use new feature
Browse files Browse the repository at this point in the history
Upgraded cobra by "go get -u github.com/spf13/cobra && go mod tidy"
  • Loading branch information
abicky committed Aug 11, 2024
1 parent ae01765 commit ef9a4d8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 285 deletions.
5 changes: 2 additions & 3 deletions cmd/reduceclustercapacity.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ that belong to the auto scaling group or spot fleet request.`,

cmd.Flags().String("auto-scaling-group-name", "", "The name of the target `GROUP`")
cmd.Flags().String("spot-fleet-request-id", "", "The ID of the target `REQUEST`")
cmd.MarkFlagsOneRequired("auto-scaling-group-name", "spot-fleet-request-id")
cmd.MarkFlagsMutuallyExclusive("auto-scaling-group-name", "spot-fleet-request-id")

cmd.Flags().String("cluster", "default", "The name of the target `CLUSTER`")

Expand All @@ -54,9 +56,6 @@ func reduceClusterCapacity(cmd *cobra.Command, args []string) error {
cluster, _ := reduceClusterCapacityCmd.Flags().GetString("cluster")
amount, _ := reduceClusterCapacityCmd.Flags().GetInt32("amount")

if len(id) == 0 && len(name) == 0 {
return errors.New("\"spot-fleet-request-id\" or \"auto-scaling-group-name\" is required")
}
if amount <= 0 {
return errors.New("\"amount\" must be greater than 0")
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ecs v1.44.3
github.com/aws/aws-sdk-go-v2/service/eventbridge v1.33.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.34.3
github.com/spf13/cobra v1.1.1
github.com/spf13/cobra v1.8.1
go.uber.org/mock v0.4.0
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
Expand All @@ -29,7 +29,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
)
Loading

0 comments on commit ef9a4d8

Please sign in to comment.