Skip to content

Commit

Permalink
More script work
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed May 5, 2023
1 parent ca73095 commit 71a32c2
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 1 deletion.
File renamed without changes.
45 changes: 45 additions & 0 deletions commandsnew/convert.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package commandsnew

import (
"context"

"github.com/bep/simplecobra"
ck "github.com/bep/simplecobra"
"github.com/spf13/cobra"
)

func newConvertCommand() *convertCommand {
return &convertCommand{
commands: []simplecobra.Commander{},
}

}

type convertCommand struct {
r *rootCommand

commands []ck.Commander
}

func (c *convertCommand) Commands() []simplecobra.Commander {
return c.commands
}

func (c *convertCommand) Name() string {
return "convert"
}

func (c *convertCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
return nil
}

func (c *convertCommand) WithCobraCommand(cmd *cobra.Command) error {
cmd.Short = "Print the site configuration"
cmd.Long = `Print the site configuration, both default and custom settings.`
return nil
}

func (c *convertCommand) Init(cd *simplecobra.Commandeer) error {
c.r = cd.Root.Command.(*rootCommand)
return nil
}
1 change: 1 addition & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func testSetupFunc() func(env *testscript.Env) error {
goVersion := runtime.Version()
// Strip all but the major and minor version.
goVersion = regexp.MustCompile(`^go(\d+\.\d+)`).FindStringSubmatch(goVersion)[1]
keyVals = append(keyVals, "GOVERSION", goVersion)
envhelpers.SetEnvVars(&env.Vars, keyVals...)

return nil
Expand Down
2 changes: 1 addition & 1 deletion testscripts/commands/gen.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Test the gen commands.
# Note that adding new commands will require updating the NUM_COMMANDS value.
env NUM_COMMANDS=34
env NUM_COMMANDS=37

hugo gen -h
stdout 'A collection of several useful generators\.'
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions testscripts/unfinished/convert.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Test the convert commands.

hugo convert -h
stdout 'asdfsdf'

0 comments on commit 71a32c2

Please sign in to comment.