diff --git a/cmd/dagger/cmd/new.go b/cmd/dagger/cmd/new.go index 8b21d3f1..9bfc86b2 100644 --- a/cmd/dagger/cmd/new.go +++ b/cmd/dagger/cmd/new.go @@ -98,12 +98,16 @@ func getNewDeploymentName(ctx context.Context) string { func getPlanSource(ctx context.Context) dagger.Input { lg := log.Ctx(ctx) - wd, err := os.Getwd() - if err != nil { - lg.Fatal().Err(err).Msg("cannot get current working directory") + planDir := viper.GetString("plan-dir") + if planDir == "" { + var err error + planDir, err = os.Getwd() + if err != nil { + lg.Fatal().Err(err).Msg("cannot get current working directory") + } } - return dagger.DirInput(wd, []string{"*.cue", "cue.mod"}) + return dagger.DirInput(planDir, []string{"*.cue", "cue.mod"}) } func init() {