Update builtin command to use CommandParams

This commit is contained in:
Chris Roberts 2022-02-09 16:57:26 -08:00 committed by Paul Hinze
parent fc8b01f0ac
commit 920fd39ec1
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 7 additions and 7 deletions

View File

@ -63,11 +63,11 @@ func (c *Command) ExecuteInfo(trm terminal.UI, env plugincore.Project) int32 {
return (&Info{Command: c}).Execute(trm, env)
}
func (c *Command) ExecuteDoThing(trm terminal.UI, flags map[string]interface{}) int32 {
return (&DoThing{Command: c}).Execute(trm, flags)
func (c *Command) ExecuteDoThing(trm terminal.UI, params *component.CommandParams) int32 {
return (&DoThing{Command: c}).Execute(trm, params)
}
func (c *Command) ExecuteInteractive(trm terminal.UI, flags map[string]interface{}) int32 {
func (c *Command) ExecuteInteractive(trm terminal.UI, params *component.CommandParams) int32 {
return (&Interactive{Command: c}).Execute(trm)
}
@ -110,8 +110,8 @@ func (c *Command) Flags() component.CommandFlags {
}
}
func (c *Command) Execute(trm terminal.UI, flags map[string]interface{}) int32 {
trm.Output("You gave me the flag: " + flags["hehe"].(string))
func (c *Command) Execute(trm terminal.UI, params *component.CommandParams) int32 {
trm.Output("You gave me the flag: " + params.Flags["hehe"].(string))
trm.Output(c.Help())
trm.Output("My subcommands are: ")

View File

@ -78,9 +78,9 @@ func (c *DoThing) Flags() component.CommandFlags {
}
}
func (c *DoThing) Execute(trm terminal.UI, flags map[string]interface{}) int32 {
func (c *DoThing) Execute(trm terminal.UI, params *component.CommandParams) int32 {
trm.Output("Tricked ya! I actually do nothing :P")
trm.Output("You gave me the stringflag: " + flags["stringflag"].(string))
trm.Output("You gave me the stringflag: " + params.Flags["stringflag"].(string))
return 0
}