Update builtin command to load target from project

This commit is contained in:
Chris Roberts 2021-08-13 15:22:07 -07:00 committed by Paul Hinze
parent 6e1dc229bb
commit 3bbab430bc
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0

View File

@ -104,7 +104,7 @@ func (c *Command) ExecuteThing(trm terminal.UI, flags map[string]interface{}) in
return 0
}
func (c *Command) ExecuteInfo(trm terminal.UI, p plugincore.Project, t plugincore.Target) int32 {
func (c *Command) ExecuteInfo(trm terminal.UI, p plugincore.Project) int32 {
mn, _ := p.MachineNames()
trm.Output("\nMachines in this project")
trm.Output(strings.Join(mn[:], "\n"))
@ -133,6 +133,12 @@ func (c *Command) ExecuteInfo(trm terminal.UI, p plugincore.Project, t plugincor
ptrm.Output("YAY! This is project specific output!")
}
t, err := p.Target("one")
if err != nil {
trm.Output("Failed to load `one' target -- " + err.Error())
return 1
}
m, err := t.Specialize((*plugincore.Machine)(nil))
if err != nil {
trm.Output("Failed to specialize to machine! -- " + err.Error())