terraform/command/module_storage.go

30 lines
617 B
Go
Raw Normal View History

2014-09-22 20:15:27 +02:00
package command
import (
"fmt"
"github.com/hashicorp/go-getter"
2014-09-22 20:15:27 +02:00
"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
2014-09-22 20:15:27 +02:00
Ui cli.Ui
}
func (s *uiModuleStorage) Dir(key string) (string, bool, error) {
return s.Storage.Dir(key)
2014-09-22 20:15:27 +02:00
}
func (s *uiModuleStorage) Get(key string, source string, update bool) error {
2014-09-22 20:18:49 +02:00
updateStr := ""
if update {
updateStr = " (update)"
}
s.Ui.Output(fmt.Sprintf("Get: %s%s", source, updateStr))
return s.Storage.Get(key, source, update)
2014-09-22 20:15:27 +02:00
}