-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,481 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package commandsnew | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/bep/simplecobra" | ||
ck "github.com/bep/simplecobra" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newTemplateCommand() *templateCommand { | ||
return &templateCommand{ | ||
commands: []ck.Commander{}, | ||
} | ||
|
||
} | ||
|
||
type templateCommand struct { | ||
rootCmd *rootCommand | ||
|
||
commands []ck.Commander | ||
} | ||
|
||
func (c *templateCommand) Commands() []simplecobra.Commander { | ||
return c.commands | ||
} | ||
|
||
func (c *templateCommand) Init(cd *simplecobra.Commandeer) error { | ||
c.rootCmd = cd.Root.Command.(*rootCommand) | ||
return nil | ||
} | ||
|
||
func (c *templateCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error { | ||
conf, err := c.rootCmd.CommonConfig(flagsToCfg(cd, nil)) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println("templateCommand.Run", conf) | ||
|
||
return nil | ||
} | ||
|
||
func (c *templateCommand) Name() string { | ||
return "template" | ||
} | ||
|
||
func (c *templateCommand) WithCobraCommand(cmd *cobra.Command) error { | ||
cmd.Short = "Print the site configuration" | ||
cmd.Long = `Print the site configuration, both default and custom settings.` | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.