Skip to content

Commit

Permalink
Merge pull request #8 from ADorigi/fix/update-flags
Browse files Browse the repository at this point in the history
fix: change flags to kebab case
  • Loading branch information
ADorigi authored Sep 16, 2024
2 parents 8b08bb5 + f0447b3 commit 9204301
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
16 changes: 8 additions & 8 deletions cmd/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ to quickly create a Cobra application.`,
RunE: func(cmd *cobra.Command, args []string) error {
configuraton := config.NewConfiguration(
utils.ReadStringFlag(cmd, "output"),
utils.ReadStringFlag(cmd, "app_endpoint"),
utils.ReadStringFlag(cmd, "utilization_analyzer_endpoint"),
utils.ReadStringFlag(cmd, "api_key"),
utils.ReadStringFlag(cmd, "app-endpoint"),
utils.ReadStringFlag(cmd, "utilization-analyzer-endpoint"),
utils.ReadStringFlag(cmd, "api-key"),
)

err := config.CreateConfigFile(configuraton)
Expand All @@ -40,12 +40,12 @@ to quickly create a Cobra application.`,
func init() {

configureCmd.Flags().String("output", "", "Output format")
configureCmd.Flags().String("app_endpoint", "", "App endpoint for API")
configureCmd.Flags().String("utilization_analyzer_endpoint", "https://optimizer.kaytu.io/", "Endpoint for Utilization and Optimization Service")
configureCmd.Flags().String("api_key", "", "API key")
configureCmd.Flags().String("app-endpoint", "", "App endpoint for API")
configureCmd.Flags().String("utilization-analyzer-endpoint", "https://optimizer.kaytu.io/", "Endpoint for Utilization and Optimization Service")
configureCmd.Flags().String("api-key", "", "API key")

configureCmd.MarkFlagRequired("output")
configureCmd.MarkFlagRequired("app_endpoint")
configureCmd.MarkFlagRequired("api_key")
configureCmd.MarkFlagRequired("app-endpoint")
configureCmd.MarkFlagRequired("api-key")

}
18 changes: 9 additions & 9 deletions cmd/get/benchmarks.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ to quickly create a Cobra application.`,
}

requestPayload := types.GetBenchmarkPayload{
Cursor: int(utils.ReadIntFlag(cmd, "page_number")),
PerPage: int(utils.ReadIntFlag(cmd, "page_size")),
OnlyRootBenchmark: utils.ReadBoolFlag(cmd, "show_only_root"),
IncludeFindingsSummary: utils.ReadBoolFlag(cmd, "include_findings_summary"),
Cursor: int(utils.ReadIntFlag(cmd, "page-number")),
PerPage: int(utils.ReadIntFlag(cmd, "page-size")),
OnlyRootBenchmark: utils.ReadBoolFlag(cmd, "show-only-root"),
IncludeFindingsSummary: utils.ReadBoolFlag(cmd, "include-findings-summary"),
}

payload, err := json.Marshal(requestPayload)
Expand Down Expand Up @@ -93,9 +93,9 @@ to quickly create a Cobra application.`,
}

fmt.Printf(
"\n\n\n\nNext Page: \n\tcheckctl get benchmarks --page_size %d --page_number %d --output %s\n",
utils.ReadIntFlag(cmd, "page_size"),
utils.ReadIntFlag(cmd, "page_number")+1,
"\n\n\n\nNext Page: \n\tcheckctl get benchmarks --page-size %d --page-number %d --output %s\n",
utils.ReadIntFlag(cmd, "page-size"),
utils.ReadIntFlag(cmd, "page-number")+1,
outputFormat,
)

Expand All @@ -104,7 +104,7 @@ to quickly create a Cobra application.`,
}

func init() {
benchmarksCmd.Flags().Bool("show_only_root", true, "Show only root benchmarks(default: true)")
benchmarksCmd.Flags().Bool("include_findings_summary", false, "Include findings summary in response(default: false)")
benchmarksCmd.Flags().Bool("show-only-root", true, "Show only root benchmarks(default: true)")
benchmarksCmd.Flags().Bool("include-findings-summary", false, "Include findings summary in response(default: false)")

}
10 changes: 5 additions & 5 deletions cmd/get/controls.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ to quickly create a Cobra application.`,
}

requestPayload := types.RequestPayload{
Cursor: int(utils.ReadIntFlag(cmd, "page_number")),
PerPage: int(utils.ReadIntFlag(cmd, "page_size")),
Cursor: int(utils.ReadIntFlag(cmd, "page-number")),
PerPage: int(utils.ReadIntFlag(cmd, "page-size")),
}

payload, err := json.Marshal(requestPayload)
Expand Down Expand Up @@ -91,9 +91,9 @@ to quickly create a Cobra application.`,
}

fmt.Printf(
"\n\n\n\nNext Page: \n\tcheckctl get controls --page_size %d --page_number %d --output %s\n",
utils.ReadIntFlag(cmd, "page_size"),
utils.ReadIntFlag(cmd, "page_number")+1,
"\n\n\n\nNext Page: \n\tcheckctl get controls --page-size %d --page-number %d --output %s\n",
utils.ReadIntFlag(cmd, "page-size"),
utils.ReadIntFlag(cmd, "page-number")+1,
outputFormat,
)

Expand Down
6 changes: 3 additions & 3 deletions cmd/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("Usage: checkctl get controls|benchmarks --page_size")
fmt.Println("Usage: checkctl get controls|benchmarks --page-size")
},
}

Expand All @@ -29,7 +29,7 @@ func init() {
GetCmd.AddCommand(controlsCmd)
GetCmd.AddCommand(benchmarksCmd)

GetCmd.PersistentFlags().Int("page_size", 25, "Defines page size of response")
GetCmd.PersistentFlags().Int("page_number", 1, "Defines page number of response")
GetCmd.PersistentFlags().Int("page-size", 25, "Defines page size of response")
GetCmd.PersistentFlags().Int("page-number", 1, "Defines page number of response")

}

0 comments on commit 9204301

Please sign in to comment.