Rename to alwaystrue host
This commit is contained in:
parent
be08dfde85
commit
768dcf07da
@ -9,29 +9,29 @@ import (
|
||||
type HostConfig struct {
|
||||
}
|
||||
|
||||
// TestOSXHost is a Host implementation for myplugin.
|
||||
type OSXHost struct {
|
||||
// AlwaysTrueHost is a Host implementation for myplugin.
|
||||
type AlwaysTrueHost struct {
|
||||
config HostConfig
|
||||
|
||||
sdkcore.CapabilityHost
|
||||
}
|
||||
|
||||
// DetectFunc implements component.Host
|
||||
func (h *OSXHost) DetectFunc() interface{} {
|
||||
return h.Detect()
|
||||
func (h *AlwaysTrueHost) DetectFunc() interface{} {
|
||||
return h.Detect
|
||||
}
|
||||
|
||||
func (h *OSXHost) Detect() bool {
|
||||
// h.InitializeCapabilities()
|
||||
func (h *AlwaysTrueHost) Detect() bool {
|
||||
h.InitializeCapabilities()
|
||||
return true
|
||||
}
|
||||
|
||||
func (h *OSXHost) InitializeCapabilities() (err error) {
|
||||
func (h *AlwaysTrueHost) InitializeCapabilities() (err error) {
|
||||
err = h.RegisterCapability("write_hello", cap.WriteHelloFunc)
|
||||
return
|
||||
}
|
||||
|
||||
var (
|
||||
_ component.Host = (*OSXHost)(nil)
|
||||
_ sdkcore.Host = (*OSXHost)(nil)
|
||||
_ component.Host = (*AlwaysTrueHost)(nil)
|
||||
_ sdkcore.Host = (*AlwaysTrueHost)(nil)
|
||||
)
|
||||
@ -2,15 +2,13 @@ package cap
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
|
||||
"github.com/hashicorp/vagrant-plugin-sdk/terminal"
|
||||
)
|
||||
|
||||
func WriteHelloFunc() interface{} {
|
||||
return WriteHello
|
||||
}
|
||||
|
||||
func WriteHello(trm terminal.UI) {
|
||||
func WriteHello() {
|
||||
data := []byte("hello\ngo\n")
|
||||
ioutil.WriteFile("/tmp/dat1", data, 0644)
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package myplugin
|
||||
import (
|
||||
sdk "github.com/hashicorp/vagrant-plugin-sdk"
|
||||
"github.com/hashicorp/vagrant/builtin/myplugin/command"
|
||||
"github.com/hashicorp/vagrant/builtin/myplugin/host"
|
||||
)
|
||||
|
||||
//go:generate protoc -I ../../.. --go_opt=plugins=grpc --go_out=../../.. vagrant-ruby/builtin/myplugin/plugin.proto
|
||||
@ -12,5 +13,6 @@ var CommandOptions = []sdk.Option{
|
||||
sdk.WithComponents(
|
||||
&Provider{},
|
||||
&command.Command{},
|
||||
&host.AlwaysTrueHost{},
|
||||
),
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user