cmd/up: show outputs at the end of the config execution
Signed-off-by: Sam Alba <sam.alba@gmail.com>
This commit is contained in:
parent
44a919e7f8
commit
d6b6142065
@ -12,7 +12,9 @@ import (
|
|||||||
"go.dagger.io/dagger/cmd/dagger/logger"
|
"go.dagger.io/dagger/cmd/dagger/logger"
|
||||||
"go.dagger.io/dagger/environment"
|
"go.dagger.io/dagger/environment"
|
||||||
"go.dagger.io/dagger/solver"
|
"go.dagger.io/dagger/solver"
|
||||||
|
"go.dagger.io/dagger/state"
|
||||||
|
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
@ -35,7 +37,12 @@ var listCmd = &cobra.Command{
|
|||||||
workspace := common.CurrentWorkspace(ctx)
|
workspace := common.CurrentWorkspace(ctx)
|
||||||
st := common.CurrentEnvironmentState(ctx, workspace)
|
st := common.CurrentEnvironmentState(ctx, workspace)
|
||||||
|
|
||||||
lg = lg.With().
|
ListOutputs(ctx, st, viper.GetBool("all"))
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func ListOutputs(ctx context.Context, st *state.State, all bool) {
|
||||||
|
lg := log.Ctx(ctx).With().
|
||||||
Str("environment", st.Name).
|
Str("environment", st.Name).
|
||||||
Logger()
|
Logger()
|
||||||
|
|
||||||
@ -61,7 +68,7 @@ var listCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else if !viper.GetBool("all") {
|
} else if !all {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +89,6 @@ var listCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
lg.Fatal().Err(err).Msg("failed to query environment")
|
lg.Fatal().Err(err).Msg("failed to query environment")
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"cuelang.org/go/cue"
|
"cuelang.org/go/cue"
|
||||||
"go.dagger.io/dagger/client"
|
"go.dagger.io/dagger/client"
|
||||||
"go.dagger.io/dagger/cmd/dagger/cmd/common"
|
"go.dagger.io/dagger/cmd/dagger/cmd/common"
|
||||||
|
"go.dagger.io/dagger/cmd/dagger/cmd/output"
|
||||||
"go.dagger.io/dagger/cmd/dagger/logger"
|
"go.dagger.io/dagger/cmd/dagger/logger"
|
||||||
"go.dagger.io/dagger/compiler"
|
"go.dagger.io/dagger/compiler"
|
||||||
"go.dagger.io/dagger/environment"
|
"go.dagger.io/dagger/environment"
|
||||||
@ -46,6 +47,8 @@ var upCmd = &cobra.Command{
|
|||||||
if err := workspace.Save(ctx, st); err != nil {
|
if err := workspace.Save(ctx, st); err != nil {
|
||||||
lg.Fatal().Err(err).Msg("failed to update environment")
|
lg.Fatal().Err(err).Msg("failed to update environment")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
output.ListOutputs(ctx, st, false)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user