passing struct to plan.Load

Signed-off-by: Richard Jones <richard@dagger.io>
This commit is contained in:
Richard Jones
2022-01-04 11:54:50 -07:00
parent 7292d62cd6
commit b4bcbab311
2 changed files with 27 additions and 19 deletions

View File

@@ -24,8 +24,6 @@ import (
"github.com/spf13/viper"
)
var withParams []string
var upCmd = &cobra.Command{
Use: "up",
Short: "Bring an environment online with latest plan and inputs",
@@ -144,7 +142,11 @@ func checkUniverseVersion(ctx context.Context, projectPath string) bool {
func europaUp(ctx context.Context, cl *client.Client, args ...string) error {
lg := log.Ctx(ctx)
p, err := plan.Load(ctx, withParams, args...)
p, err := plan.Load(ctx, plan.Config{
Args: args,
With: viper.GetStringSlice("with"),
})
if err != nil {
lg.Fatal().Err(err).Msg("failed to load plan")
}
@@ -222,7 +224,7 @@ func checkInputs(ctx context.Context, env *environment.Environment) error {
func init() {
upCmd.Flags().BoolP("force", "f", false, "Force up, disable inputs check")
upCmd.Flags().String("output", "", "Write computed output. Prints on stdout if set to-")
upCmd.Flags().StringArrayVarP(&withParams, "with", "w", []string{}, "")
upCmd.Flags().StringArrayP("with", "w", []string{}, "")
if err := viper.BindPFlags(upCmd.Flags()); err != nil {
panic(err)