From 16c1d104beeb9f5790296dd77dfefb7eb935dfea Mon Sep 17 00:00:00 2001 From: Itay Levy Date: Wed, 16 Aug 2023 13:50:48 +0300 Subject: [PATCH] Added an optional no-output flag to roller run --- cmd/run/run.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/cmd/run/run.go b/cmd/run/run.go index 026dd683..77dd8a5b 100644 --- a/cmd/run/run.go +++ b/cmd/run/run.go @@ -19,6 +19,12 @@ import ( "github.com/spf13/cobra" ) +var flagNames = struct { + NoOutput string +}{ + NoOutput: "no-output", +} + func Cmd() *cobra.Command { cmd := &cobra.Command{ Use: "run", @@ -47,7 +53,13 @@ func Cmd() *cobra.Command { runRelayerWithRestarts(rollappConfig, serviceConfig) /* ------------------------------ render output ----------------------------- */ - RenderUI(rollappConfig, serviceConfig) + noOutput, err := cmd.Flags().GetBool(flagNames.NoOutput) + utils.PrettifyErrorIfExists(err) + if noOutput { + select {} + } else { + RenderUI(rollappConfig, serviceConfig) + } cancel() spin := utils.GetLoadingSpinner() spin.Suffix = " Stopping rollapp services, please wait..." @@ -57,7 +69,7 @@ func Cmd() *cobra.Command { spin.Stop() }, } - + cmd.Flags().BoolP(flagNames.NoOutput, "", false, "Run the rollapp without rendering the UI.") return cmd }