cmd: wire --input flag into client

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi
2021-01-14 15:19:39 -08:00
parent 9338d10a04
commit 16fd14b0c9
2 changed files with 34 additions and 21 deletions

View File

@@ -27,8 +27,10 @@ var computeCmd = &cobra.Command{
lg := logger.New()
ctx := lg.WithContext(appcontext.Context())
// FIXME: boot and bootdir should be config fields, not args
c, err := dagger.NewClient(ctx, "", "", args[0])
c, err := dagger.NewClient(ctx, dagger.ClientConfig{
Input: viper.GetString("input"),
BootDir: args[0],
})
if err != nil {
lg.Fatal().Err(err).Msg("unable to create client")
}
@@ -43,3 +45,11 @@ var computeCmd = &cobra.Command{
fmt.Println(output.JSON())
},
}
func init() {
computeCmd.Flags().String("input", "", "Input overlay")
if err := viper.BindPFlags(computeCmd.Flags()); err != nil {
panic(err)
}
}