summaryrefslogtreecommitdiffstats
path: root/commands/config.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-17 18:45:23 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-17 22:13:29 +0200
commit8a69ccbb00e7978c6c5d57e353ce178c2b732b07 (patch)
treeb2f4a1438ae504555571b3e71a205c9022ec68b2 /commands/config.go
parent7ce033a89d411036e40dbb42325e30e12248bda9 (diff)
commands: Improve the common build flag handling
Updates #10947
Diffstat (limited to 'commands/config.go')
-rw-r--r--commands/config.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/commands/config.go b/commands/config.go
index 6f0a29b35..80b869a28 100644
--- a/commands/config.go
+++ b/commands/config.go
@@ -23,7 +23,6 @@ import (
"github.com/gohugoio/hugo/modules"
"github.com/gohugoio/hugo/parser"
"github.com/gohugoio/hugo/parser/metadecoders"
- "github.com/spf13/cobra"
)
// newConfigCommand creates a new config command and its subcommands.
@@ -68,13 +67,14 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
return nil
}
-func (c *configCommand) WithCobraCommand(cmd *cobra.Command) error {
+func (c *configCommand) Init(cd *simplecobra.Commandeer) error {
+ cmd := cd.CobraCommand
cmd.Short = "Print the site configuration"
cmd.Long = `Print the site configuration, both default and custom settings.`
return nil
}
-func (c *configCommand) Init(cd, runner *simplecobra.Commandeer) error {
+func (c *configCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
c.r = cd.Root.Command.(*rootCommand)
return nil
}
@@ -176,12 +176,13 @@ func (c *configMountsCommand) Run(ctx context.Context, cd *simplecobra.Commandee
return nil
}
-func (c *configMountsCommand) WithCobraCommand(cmd *cobra.Command) error {
+func (c *configMountsCommand) Init(cd *simplecobra.Commandeer) error {
+ cmd := cd.CobraCommand
cmd.Short = "Print the configured file mounts"
return nil
}
-func (c *configMountsCommand) Init(cd, runner *simplecobra.Commandeer) error {
+func (c *configMountsCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
c.configCmd = cd.Parent.Command.(*configCommand)
return nil
}