cli: add 'test placeholder' subcommand for placeholder debugging

This commit is contained in:
Christian Schwarz
2018-11-16 11:25:48 +01:00
parent ca6d5d3bb5
commit 2db3977408
2 changed files with 88 additions and 3 deletions

View File

@ -42,6 +42,7 @@ func init() {
type Subcommand struct {
Use string
Short string
Example string
NoRequireConfig bool
Run func(subcommand *Subcommand, args []string) error
SetupFlags func(f *pflag.FlagSet)
@ -94,6 +95,7 @@ func addSubcommandToCobraCmd(c *cobra.Command, s *Subcommand) {
cmd := cobra.Command{
Use: s.Use,
Short: s.Short,
Example: s.Example,
}
if s.SetupSubcommands == nil {
cmd.Run = s.run
@ -113,4 +115,4 @@ func Run() {
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
}