mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
ffe056bacb
This is part of a general effort to move all of Terraform's non-library package surface under internal in order to reinforce that these are for internal use within Terraform only. If you were previously importing packages under this prefix into an external codebase, you could pin to an earlier release tag as an interim solution until you've make a plan to achieve the same functionality some other way.
34 lines
855 B
Go
34 lines
855 B
Go
package command
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
version "github.com/hashicorp/go-version"
|
|
"github.com/hashicorp/terraform/internal/initwd"
|
|
"github.com/mitchellh/cli"
|
|
)
|
|
|
|
type uiModuleInstallHooks struct {
|
|
initwd.ModuleInstallHooksImpl
|
|
Ui cli.Ui
|
|
ShowLocalPaths bool
|
|
}
|
|
|
|
var _ initwd.ModuleInstallHooks = uiModuleInstallHooks{}
|
|
|
|
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))
|
|
}
|
|
}
|