From f86b5f70a60fc3793bc826f2ccd8dcdd62e26b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 27 May 2023 15:04:36 +0200 Subject: commands: Move the --format flag to only the commands that support it Fixes #11022 --- commands/commandeer.go | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'commands/commandeer.go') diff --git a/commands/commandeer.go b/commands/commandeer.go index 08f959579..7b0c41652 100644 --- a/commands/commandeer.go +++ b/commands/commandeer.go @@ -108,9 +108,6 @@ type rootCommand struct { buildWatch bool environment string - // File format to read or write (TOML, YAML, JSON). - format string - // Common build flags. baseURL string gc bool @@ -408,12 +405,6 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error { if err != nil { return err } - switch r.format { - case "json", "toml", "yaml": - // OK - default: - return fmt.Errorf("unsupported format %q; must be one of json, toml or yaml", r.format) - } loggers.PanicOnWarning.Store(r.panicOnWarning) r.commonConfigs = lazycache.New[int32, *commonConfig](lazycache.Options{MaxEntries: 5}) @@ -485,7 +476,6 @@ Complete documentation is available at https://gohugo.io/.` // Configure persistent flags cmd.PersistentFlags().StringVarP(&r.source, "source", "s", "", "filesystem path to read files relative from") - cmd.PersistentFlags().StringVar(&r.format, "format", "toml", "preferred file format (toml, yaml or json)") cmd.PersistentFlags().SetAnnotation("source", cobra.BashCompSubdirsInDir, []string{}) cmd.PersistentFlags().StringP("destination", "d", "", "filesystem path to write files to") cmd.PersistentFlags().SetAnnotation("destination", cobra.BashCompSubdirsInDir, []string{}) -- cgit v1.2.3