cmd/new: implemented --plan-dir

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-04-01 11:12:44 -07:00
parent b9b195b70f
commit 29cad95f1d

View File

@ -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() {