Call capability func

This commit is contained in:
sophia 2021-06-14 13:05:17 -05:00 committed by Paul Hinze
parent c621b5f561
commit 9ebd62b37a
No known key found for this signature in database
GPG Key ID: B69DEDF2D55501C0
2 changed files with 3 additions and 4 deletions

View File

@ -2,11 +2,10 @@ package cap
import (
"io/ioutil"
"github.com/hashicorp/vagrant-plugin-sdk/terminal"
// "github.com/hashicorp/vagrant-plugin-sdk/terminal"
)
func WriteHello(ui terminal.UI) error {
func WriteHello() error {
data := []byte("Hello from the write hello capability, compliments of the AlwaysTrue Host")
ioutil.WriteFile("/tmp/hello", data, 0644)
return nil

View File

@ -162,7 +162,7 @@ func (c *Command) ExecuteUseHostPlugin(trm terminal.UI, host plugincore.Host) in
ok := host.HasCapability("write_hello")
if ok {
trm.Output("Writing to file using `write_hello` capability")
_, err := host.Capability("write_hello", argmapper.Typed("hehehe i'm a string"), argmapper.Typed(trm))
_, err := host.Capability("write_hello", argmapper.Typed(trm))
if err != nil {
trm.Output("Error!")
return 1