From 4f5699554197ed3fe471164e711e5876651d088b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 1 Feb 2025 23:43:23 +0200 Subject: [PATCH] fix(build): --output completion usage Passing the empty string as an extension is a functional no-op, but causes actual problems: https://github.com/spf13/cobra/pull/2228 Remove marking the flag as taking filename altogether, as there's no need to do that; cobra comments doing so as a mistake: https://github.com/spf13/cobra/blob/41b26ec8bb59dfba580f722201bf371c4f5703dd/completions.go#L387-L390 Leave MarkFlagFilename in comments so it's clear it's not inadvertently left out. --- cmd/build.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/build.go b/cmd/build.go index 9c75f7b5e84..ed8a0803dc7 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -97,7 +97,7 @@ When using ` + "`--single-target`" + `, you use the ` + "`TARGET`, or GOOS`, `GO }) cmd.Flags().BoolVar(&root.opts.deprecated, "deprecated", false, "Force print the deprecation message - tests only") cmd.Flags().StringVarP(&root.opts.output, "output", "o", "", "Copy the binary to the path after the build. Only taken into account when using --single-target and a single id (either with --id or if configuration only has one build)") - _ = cmd.MarkFlagFilename("output", "") + // _ = cmd.MarkFlagFilename("output") // no extensions to filter _ = cmd.Flags().MarkHidden("deprecated") cmd.Flags().StringSliceVar(