mirror of https://github.com/hashicorp/terraform
Update the command package to use the new module storage. Move the old command output strings into the module storage itself. This could be moved back later either by using ui callbacks, or designing a module storage interface once we know what the final requirements will look like.pull/16481/head
parent
36eb40a432
commit
f2a7b94692
@ -1,29 +0,0 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/hashicorp/go-getter"
|
||||
"github.com/mitchellh/cli"
|
||||
)
|
||||
|
||||
// uiModuleStorage implements module.Storage and is just a proxy to output
|
||||
// to the UI any Get operations.
|
||||
type uiModuleStorage struct {
|
||||
Storage getter.Storage
|
||||
Ui cli.Ui
|
||||
}
|
||||
|
||||
func (s *uiModuleStorage) Dir(key string) (string, bool, error) {
|
||||
return s.Storage.Dir(key)
|
||||
}
|
||||
|
||||
func (s *uiModuleStorage) Get(key string, source string, update bool) error {
|
||||
updateStr := ""
|
||||
if update {
|
||||
updateStr = " (update)"
|
||||
}
|
||||
|
||||
s.Ui.Output(fmt.Sprintf("Get: %s%s", source, updateStr))
|
||||
return s.Storage.Get(key, source, update)
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/go-getter"
|
||||
)
|
||||
|
||||
func TestUiModuleStorage_impl(t *testing.T) {
|
||||
var _ getter.Storage = new(uiModuleStorage)
|
||||
}
|
||||
Loading…
Reference in new issue