cli: moved input dir to abs path - fixes #254

Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
Sam Alba 2021-04-02 16:41:26 -07:00
parent b12a3bf45f
commit 3e605d1d72
2 changed files with 14 additions and 2 deletions

View File

@ -1,6 +1,8 @@
package input
import (
"path/filepath"
"dagger.io/go/cmd/dagger/logger"
"dagger.io/go/dagger"
"github.com/spf13/cobra"
@ -22,7 +24,12 @@ var dirCmd = &cobra.Command{
lg := logger.New()
ctx := lg.WithContext(cmd.Context())
updateDeploymentInput(ctx, args[0], dagger.DirInput(args[1], []string{}))
path, err := filepath.Abs(args[1])
if err != nil {
lg.Error().Err(err).Str("path", args[1]).Msg("cannot get absolute path")
}
updateDeploymentInput(ctx, args[0], dagger.DirInput(path, []string{}))
},
}

View File

@ -102,7 +102,12 @@ func getPlanSource(ctx context.Context) dagger.Input {
if planDir != "" {
checkFirstSet()
src = dagger.DirInput(planDir, []string{"*.cue", "cue.mod"})
path, err := filepath.Abs(planDir)
if err != nil {
lg.Error().Err(err).Str("path", planDir).Msg("cannot get absolute path")
}
src = dagger.DirInput(path, []string{"*.cue", "cue.mod"})
}
if planGit != "" {