Skip to content

Commit d6a4821

Browse files
committed
fix -w to output markers without additional argument
1 parent f5253ab commit d6a4821

File tree

1 file changed

+4
-1
lines changed
  • pkg/customresourcestate/generate

1 file changed

+4
-1
lines changed

pkg/customresourcestate/generate/cmd.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@ var GenerateCommand = &cobra.Command{
4646
Use: "generate [flags] /path/to/package [/path/to/package]",
4747
Short: "Generate custom resource metrics configuration from go-code markers (experimental).",
4848
DisableFlagsInUseLine: true,
49-
Args: cobra.MinimumNArgs(1),
5049
RunE: func(cmd *cobra.Command, args []string) error {
5150
if generateWhichMarkersFlag {
5251
PrintMarkerDocs()
5352
return nil
5453
}
5554

55+
if len(args) == 0 {
56+
return fmt.Errorf("requires at least 1 arg(s), only received %d", len(args))
57+
}
58+
5659
// Register the metric generator itself as marker so genall.FromOptions is able to initialize the runtime properly.
5760
// This also registers the markers inside the optionsRegistry so its available to print the marker docs.
5861
metricGenerator := generator.CustomResourceConfigGenerator{}

0 commit comments

Comments
 (0)