commands: Improve the common build flag handling

Updates #10947
This commit is contained in:
Bjørn Erik Pedersen 2023-05-17 18:45:23 +02:00
parent 7ce033a89d
commit 8a69ccbb00
16 changed files with 86 additions and 71 deletions

View file

@ -100,7 +100,8 @@ func (c *convertCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, ar
return nil
}
func (c *convertCommand) WithCobraCommand(cmd *cobra.Command) error {
func (c *convertCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Convert your content to different formats"
cmd.Long = `Convert your content (e.g. front matter) to different formats.
@ -112,7 +113,7 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.`
return nil
}
func (c *convertCommand) Init(cd, runner *simplecobra.Commandeer) error {
func (c *convertCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
c.r = cd.Root.Command.(*rootCommand)
cfg := config.New()
cfg.Set("buildDrafts", true)