commands: Add the common build flags to the config commands - hugo - [fork] hugo port for 9front
 (HTM) git clone git@git.drkhsh.at/hugo.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) Submodules
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 51d0a0ab01157e65fcc8a90389559489ce98765a
 (DIR) parent fd099331ec82c21e1fd7ee1cdb9630b820714643
 (HTM) Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Sun, 28 May 2023 13:06:26 +0200
       
       commands: Add the common build flags to the config commands
       
       Which allows to see the config with `--theme` applied.
       
       Updates #11018
       
       Diffstat:
         M commands/commandeer.go              |       2 +-
         M commands/config.go                  |       6 +++++-
       
       2 files changed, 6 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/commands/commandeer.go b/commands/commandeer.go
       @@ -520,7 +520,6 @@ func applyLocalFlagsBuildConfig(cmd *cobra.Command, r *rootCommand) {
                cmd.Flags().StringP("cacheDir", "", "", "filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache/")
                _ = cmd.Flags().SetAnnotation("cacheDir", cobra.BashCompSubdirsInDir, []string{})
                cmd.Flags().StringP("contentDir", "c", "", "filesystem path to content directory")
       -        cmd.Flags().StringP("layoutDir", "l", "", "filesystem path to layout directory")
                _ = cmd.Flags().SetAnnotation("theme", cobra.BashCompSubdirsInDir, []string{"themes"})
        
        }
       @@ -534,6 +533,7 @@ func applyLocalFlagsBuild(cmd *cobra.Command, r *rootCommand) {
                cmd.Flags().BoolP("buildExpired", "E", false, "include expired content")
                cmd.Flags().BoolP("ignoreCache", "", false, "ignores the cache directory")
                cmd.Flags().Bool("enableGitInfo", false, "add Git revision, date, author, and CODEOWNERS info to the pages")
       +        cmd.Flags().StringP("layoutDir", "l", "", "filesystem path to layout directory")
                cmd.Flags().BoolVar(&r.gc, "gc", false, "enable to run some cleanup tasks (remove unused cache files) after the build")
                cmd.Flags().StringVar(&r.poll, "poll", "", "set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes")
                cmd.Flags().BoolVar(&r.panicOnWarning, "panicOnWarning", false, "panic on first WARNING log")
 (DIR) diff --git a/commands/config.go b/commands/config.go
       @@ -95,16 +95,17 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
        }
        
        func (c *configCommand) Init(cd *simplecobra.Commandeer) error {
       +        c.r = cd.Root.Command.(*rootCommand)
                cmd := cd.CobraCommand
                cmd.Short = "Print the site configuration"
                cmd.Long = `Print the site configuration, both default and custom settings.`
                cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)")
       +        applyLocalFlagsBuildConfig(cmd, c.r)
        
                return nil
        }
        
        func (c *configCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
       -        c.r = cd.Root.Command.(*rootCommand)
                return nil
        }
        
       @@ -179,6 +180,7 @@ func (m *configModMounts) MarshalJSON() ([]byte, error) {
        }
        
        type configMountsCommand struct {
       +        r         *rootCommand
                configCmd *configCommand
        }
        
       @@ -206,8 +208,10 @@ func (c *configMountsCommand) Run(ctx context.Context, cd *simplecobra.Commandee
        }
        
        func (c *configMountsCommand) Init(cd *simplecobra.Commandeer) error {
       +        c.r = cd.Root.Command.(*rootCommand)
                cmd := cd.CobraCommand
                cmd.Short = "Print the configured file mounts"
       +        applyLocalFlagsBuildConfig(cmd, c.r)
                return nil
        }