Skip to content

Commit

Permalink
fix -w to output markers without additional argument
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischdi committed Dec 5, 2023
1 parent 8260a0f commit 3104735
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/customresourcestate/generate/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,16 @@ var GenerateCommand = &cobra.Command{
Use: "generate [flags] /path/to/package [/path/to/package]",
Short: "Generate custom resource metrics configuration from go-code markers (experimental).",
DisableFlagsInUseLine: true,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
if generateWhichMarkersFlag {
PrintMarkerDocs()
return nil
}

if len(args) == 0 {
return fmt.Errorf("requires at least 1 arg(s), only received %d", len(args))
}

// Register the metric generator itself as marker so genall.FromOptions is able to initialize the runtime properly.
// This also registers the markers inside the optionsRegistry so its available to print the marker docs.
metricGenerator := generator.CustomResourceConfigGenerator{}
Expand Down

0 comments on commit 3104735

Please sign in to comment.