Don't print the deployment state at the end of each command

Signed-off-by: Solomon Hykes <sh.github.6811@hykes.org>
This commit is contained in:
Solomon Hykes 2021-04-02 00:47:51 +00:00
parent 67af849dd9
commit 0a28f04857
4 changed files with 9 additions and 5 deletions

View File

@ -58,7 +58,9 @@ func GetCurrentDeploymentState(ctx context.Context, store *dagger.Store) *dagger
return st
}
func DeploymentUp(ctx context.Context, deployment *dagger.Deployment) {
// Re-compute a deployment (equivalent to `dagger up`).
// If printOutput is true, print the JSON-encoded computed state to standard output
func DeploymentUp(ctx context.Context, deployment *dagger.Deployment, printOutput bool) {
lg := log.Ctx(ctx)
c, err := dagger.NewClient(ctx, "")
@ -72,5 +74,7 @@ func DeploymentUp(ctx context.Context, deployment *dagger.Deployment) {
if err != nil {
lg.Fatal().Err(err).Msg("failed to up deployment")
}
if printOutput {
fmt.Println(output.JSON())
}
}

View File

@ -132,7 +132,7 @@ var computeCmd = &cobra.Command{
lg.Fatal().Err(err).Msg("unable to initialize deployment")
}
common.DeploymentUp(ctx, deployment)
common.DeploymentUp(ctx, deployment, true)
},
}

View File

@ -70,7 +70,7 @@ var newCmd = &cobra.Command{
}
if viper.GetBool("up") {
common.DeploymentUp(ctx, deployment)
common.DeploymentUp(ctx, deployment, false)
}
},
}

View File

@ -31,7 +31,7 @@ var upCmd = &cobra.Command{
deployment := common.GetCurrentDeployment(ctx, store)
// TODO: Implement options: --no-cache
common.DeploymentUp(ctx, deployment)
common.DeploymentUp(ctx, deployment, false)
},
}