From b00228c5555117c16c165139d7a07a7b009a371d Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 2 Aug 2024 03:48:38 +0200 Subject: [PATCH 1/3] add missing verbose mode flags --- ignite/cmd/chain_build.go | 2 +- ignite/cmd/chain_debug.go | 6 +++++- ignite/cmd/chain_faucet.go | 1 + ignite/cmd/chain_init.go | 1 + ignite/cmd/chain_lint.go | 3 +++ ignite/cmd/chain_serve.go | 3 ++- ignite/cmd/cmd.go | 8 +++++++- 7 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ignite/cmd/chain_build.go b/ignite/cmd/chain_build.go index 044ca6f38c..470769161d 100644 --- a/ignite/cmd/chain_build.go +++ b/ignite/cmd/chain_build.go @@ -88,12 +88,12 @@ for your current environment. c.Flags().AddFlagSet(flagSetCheckDependencies()) c.Flags().AddFlagSet(flagSetSkipProto()) c.Flags().AddFlagSet(flagSetDebug()) + c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().Bool(flagRelease, false, "build for a release") c.Flags().StringSliceP(flagReleaseTargets, "t", []string{}, "release targets. Available only with --release flag") c.Flags().StringSlice(flagBuildTags, []string{}, "parameters to build the chain binary") c.Flags().String(flagReleasePrefix, "", "tarball prefix for each release target. Available only with --release flag") c.Flags().StringP(flagOutput, "o", "", "binary output path") - c.Flags().BoolP("verbose", "v", false, "verbose output") return c } diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index 37220aa0e1..9933736d13 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -57,6 +57,7 @@ The debug server stops automatically when the client connection is closed. } flagSetPath(c) + c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().Bool(flagServer, false, "start a debug server") c.Flags().String(flagServerAddress, debugger.DefaultAddress, "debug server address") @@ -66,7 +67,10 @@ The debug server stops automatically when the client connection is closed. func chainDebugHandler(cmd *cobra.Command, _ []string) error { // Prepare session options. // Events are ignored by the session when the debug server UI is used. - options := []cliui.Option{cliui.StartSpinnerWithText("Initializing...")} + options := []cliui.Option{ + cliui.StartSpinnerWithText("Initializing..."), + cliui.WithVerbosity(getVerbosity(cmd)), + } server, _ := cmd.Flags().GetBool(flagServer) if server { options = append(options, cliui.IgnoreEvents()) diff --git a/ignite/cmd/chain_faucet.go b/ignite/cmd/chain_faucet.go index 83df815ff5..f8d0f25c18 100644 --- a/ignite/cmd/chain_faucet.go +++ b/ignite/cmd/chain_faucet.go @@ -21,6 +21,7 @@ func NewChainFaucet() *cobra.Command { flagSetPath(c) c.Flags().AddFlagSet(flagSetHome()) + c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().BoolP("verbose", "v", false, "verbose output") return c diff --git a/ignite/cmd/chain_init.go b/ignite/cmd/chain_init.go index de602d2362..9a40fecd61 100644 --- a/ignite/cmd/chain_init.go +++ b/ignite/cmd/chain_init.go @@ -88,6 +88,7 @@ commands manually to ensure a production-level node initialization. c.Flags().AddFlagSet(flagSetCheckDependencies()) c.Flags().AddFlagSet(flagSetSkipProto()) c.Flags().AddFlagSet(flagSetDebug()) + c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().StringSlice(flagBuildTags, []string{}, "parameters to build the chain binary") return c diff --git a/ignite/cmd/chain_lint.go b/ignite/cmd/chain_lint.go index 7dcf13b5d5..6aa8f0f3f3 100644 --- a/ignite/cmd/chain_lint.go +++ b/ignite/cmd/chain_lint.go @@ -17,6 +17,7 @@ func NewChainLint() *cobra.Command { RunE: func(cmd *cobra.Command, _ []string) error { session := cliui.New( cliui.StartSpinnerWithText("Linting..."), + cliui.WithVerbosity(getVerbosity(cmd)), ) defer session.End() @@ -34,5 +35,7 @@ func NewChainLint() *cobra.Command { }, } + c.Flags().AddFlagSet(flagSetVerbose()) + return c } diff --git a/ignite/cmd/chain_serve.go b/ignite/cmd/chain_serve.go index 1b10aef164..9b3c1c9207 100644 --- a/ignite/cmd/chain_serve.go +++ b/ignite/cmd/chain_serve.go @@ -16,6 +16,7 @@ import ( ) const ( + flagVerbose = "verbose" flagConfig = "config" flagForceReset = "force-reset" flagGenerateClients = "generate-clients" @@ -70,7 +71,7 @@ production, you may want to run "appd start" manually. c.Flags().AddFlagSet(flagSetHome()) c.Flags().AddFlagSet(flagSetCheckDependencies()) c.Flags().AddFlagSet(flagSetSkipProto()) - c.Flags().BoolP("verbose", "v", false, "verbose output") + c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().BoolP(flagForceReset, "f", false, "force reset of the app state on start and every source change") c.Flags().BoolP(flagResetOnce, "r", false, "reset the app state once on init") c.Flags().Bool(flagGenerateClients, false, "generate code for the configured clients on reset or source code change") diff --git a/ignite/cmd/cmd.go b/ignite/cmd/cmd.go index c7cfdcdd28..2ebb8b06ac 100644 --- a/ignite/cmd/cmd.go +++ b/ignite/cmd/cmd.go @@ -109,8 +109,14 @@ To get started, create a blockchain: }, nil } +func flagSetVerbose() *flag.FlagSet { + fs := flag.NewFlagSet("", flag.ContinueOnError) + fs.BoolP(flagVerbose, "v", false, "verbose output") + return fs +} + func getVerbosity(cmd *cobra.Command) uilog.Verbosity { - if verbose, _ := cmd.Flags().GetBool("verbose"); verbose { + if verbose, _ := cmd.Flags().GetBool(flagVerbose); verbose { return uilog.VerbosityVerbose } From a8a591d3a16bef3ffbfe6bc476d2ecca13234cce Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 2 Aug 2024 03:52:19 +0200 Subject: [PATCH 2/3] add changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index f24651cce6..dcbbe56a54 100644 --- a/changelog.md +++ b/changelog.md @@ -44,6 +44,7 @@ - [#4000](https://github.com/ignite/cli/pull/4000) Run all dry runners before the wet run in the `xgenny` pkg - [#4091](https://github.com/ignite/cli/pull/4091) Fix race conditions in the plugin logic - [#4128](https://github.com/ignite/cli/pull/4128) Check for duplicate proto fields in config +- [#4286](https://github.com/ignite/cli/pull/4286) Add missing verbose mode flags ## [`v28.5.0`](https://github.com/ignite/cli/releases/tag/v28.5.0) From 640be746642c8177fc17611a10a473d61df72deb Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Fri, 2 Aug 2024 04:07:14 +0200 Subject: [PATCH 3/3] remove unused debug flag --- ignite/cmd/chain_debug.go | 6 +----- ignite/cmd/chain_faucet.go | 6 +----- ignite/cmd/chain_lint.go | 7 +------ 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/ignite/cmd/chain_debug.go b/ignite/cmd/chain_debug.go index 9933736d13..37220aa0e1 100644 --- a/ignite/cmd/chain_debug.go +++ b/ignite/cmd/chain_debug.go @@ -57,7 +57,6 @@ The debug server stops automatically when the client connection is closed. } flagSetPath(c) - c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().Bool(flagServer, false, "start a debug server") c.Flags().String(flagServerAddress, debugger.DefaultAddress, "debug server address") @@ -67,10 +66,7 @@ The debug server stops automatically when the client connection is closed. func chainDebugHandler(cmd *cobra.Command, _ []string) error { // Prepare session options. // Events are ignored by the session when the debug server UI is used. - options := []cliui.Option{ - cliui.StartSpinnerWithText("Initializing..."), - cliui.WithVerbosity(getVerbosity(cmd)), - } + options := []cliui.Option{cliui.StartSpinnerWithText("Initializing...")} server, _ := cmd.Flags().GetBool(flagServer) if server { options = append(options, cliui.IgnoreEvents()) diff --git a/ignite/cmd/chain_faucet.go b/ignite/cmd/chain_faucet.go index f8d0f25c18..4e2515dedc 100644 --- a/ignite/cmd/chain_faucet.go +++ b/ignite/cmd/chain_faucet.go @@ -21,7 +21,6 @@ func NewChainFaucet() *cobra.Command { flagSetPath(c) c.Flags().AddFlagSet(flagSetHome()) - c.Flags().AddFlagSet(flagSetVerbose()) c.Flags().BoolP("verbose", "v", false, "verbose output") return c @@ -31,10 +30,7 @@ func chainFaucetHandler(cmd *cobra.Command, args []string) error { var ( toAddress = args[0] coins = args[1] - session = cliui.New( - cliui.WithVerbosity(getVerbosity(cmd)), - cliui.StartSpinner(), - ) + session = cliui.New(cliui.StartSpinner()) ) defer session.End() diff --git a/ignite/cmd/chain_lint.go b/ignite/cmd/chain_lint.go index 6aa8f0f3f3..895b6e31c4 100644 --- a/ignite/cmd/chain_lint.go +++ b/ignite/cmd/chain_lint.go @@ -15,10 +15,7 @@ func NewChainLint() *cobra.Command { Long: "The lint command runs the golangci-lint tool to lint the codebase.", Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, _ []string) error { - session := cliui.New( - cliui.StartSpinnerWithText("Linting..."), - cliui.WithVerbosity(getVerbosity(cmd)), - ) + session := cliui.New(cliui.StartSpinnerWithText("Linting...")) defer session.End() chainOption := []chain.Option{ @@ -35,7 +32,5 @@ func NewChainLint() *cobra.Command { }, } - c.Flags().AddFlagSet(flagSetVerbose()) - return c }