github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/internal/command/hook_module_install.go (about)

     1  package command
     2  
     3  import (
     4  	"fmt"
     5  
     6  	version "github.com/hashicorp/go-version"
     7  	"github.com/hashicorp/terraform/internal/initwd"
     8  	"github.com/mitchellh/cli"
     9  )
    10  
    11  type uiModuleInstallHooks struct {
    12  	initwd.ModuleInstallHooksImpl
    13  	Ui             cli.Ui
    14  	ShowLocalPaths bool
    15  }
    16  
    17  var _ initwd.ModuleInstallHooks = uiModuleInstallHooks{}
    18  
    19  func (h uiModuleInstallHooks) Download(modulePath, packageAddr string, v *version.Version) {
    20  	if v != nil {
    21  		h.Ui.Info(fmt.Sprintf("Downloading %s %s for %s...", packageAddr, v, modulePath))
    22  	} else {
    23  		h.Ui.Info(fmt.Sprintf("Downloading %s for %s...", packageAddr, modulePath))
    24  	}
    25  }
    26  
    27  func (h uiModuleInstallHooks) Install(modulePath string, v *version.Version, localDir string) {
    28  	if h.ShowLocalPaths {
    29  		h.Ui.Info(fmt.Sprintf("- %s in %s", modulePath, localDir))
    30  	} else {
    31  		h.Ui.Info(fmt.Sprintf("- %s", modulePath))
    32  	}
    33  }