github.com/nevins-b/terraform@v0.3.8-0.20170215184714-bbae22007d5a/command/module_storage.go (about)

     1  package command
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/hashicorp/go-getter"
     7  	"github.com/mitchellh/cli"
     8  )
     9  
    10  // uiModuleStorage implements module.Storage and is just a proxy to output
    11  // to the UI any Get operations.
    12  type uiModuleStorage struct {
    13  	Storage getter.Storage
    14  	Ui      cli.Ui
    15  }
    16  
    17  func (s *uiModuleStorage) Dir(key string) (string, bool, error) {
    18  	return s.Storage.Dir(key)
    19  }
    20  
    21  func (s *uiModuleStorage) Get(key string, source string, update bool) error {
    22  	updateStr := ""
    23  	if update {
    24  		updateStr = " (update)"
    25  	}
    26  
    27  	s.Ui.Output(fmt.Sprintf("Get: %s%s", source, updateStr))
    28  	return s.Storage.Get(key, source, update)
    29  }