2014-09-22 20:15:27 +02:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
2015-10-15 22:48:58 +02:00
|
|
|
"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 {
|
2015-10-15 22:48:58 +02:00
|
|
|
Storage getter.Storage
|
2014-09-22 20:15:27 +02:00
|
|
|
Ui cli.Ui
|
|
|
|
}
|
|
|
|
|
2015-04-08 01:46:56 +02:00
|
|
|
func (s *uiModuleStorage) Dir(key string) (string, bool, error) {
|
|
|
|
return s.Storage.Dir(key)
|
2014-09-22 20:15:27 +02:00
|
|
|
}
|
|
|
|
|
2015-04-08 01:46:56 +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))
|
2015-04-08 01:46:56 +02:00
|
|
|
return s.Storage.Get(key, source, update)
|
2014-09-22 20:15:27 +02:00
|
|
|
}
|