2018-03-01 02:09:48 +01:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
version "github.com/hashicorp/go-version"
|
2019-01-09 03:39:14 +01:00
|
|
|
"github.com/hashicorp/terraform/internal/initwd"
|
2018-03-01 02:09:48 +01:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
|
|
|
type uiModuleInstallHooks struct {
|
2019-01-09 03:39:14 +01:00
|
|
|
initwd.ModuleInstallHooksImpl
|
2018-03-01 02:09:48 +01:00
|
|
|
Ui cli.Ui
|
|
|
|
ShowLocalPaths bool
|
|
|
|
}
|
|
|
|
|
2019-01-09 03:39:14 +01:00
|
|
|
var _ initwd.ModuleInstallHooks = uiModuleInstallHooks{}
|
2018-03-01 02:09:48 +01:00
|
|
|
|
|
|
|
func (h uiModuleInstallHooks) Download(modulePath, packageAddr string, v *version.Version) {
|
|
|
|
if v != nil {
|
|
|
|
h.Ui.Info(fmt.Sprintf("Downloading %s %s for %s...", packageAddr, v, modulePath))
|
|
|
|
} else {
|
|
|
|
h.Ui.Info(fmt.Sprintf("Downloading %s for %s...", packageAddr, modulePath))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h uiModuleInstallHooks) Install(modulePath string, v *version.Version, localDir string) {
|
|
|
|
if h.ShowLocalPaths {
|
|
|
|
h.Ui.Info(fmt.Sprintf("- %s in %s", modulePath, localDir))
|
|
|
|
} else {
|
|
|
|
h.Ui.Info(fmt.Sprintf("- %s", modulePath))
|
|
|
|
}
|
|
|
|
}
|