From 2a968e8684cae0a1d79ccb11f0db067a4605173e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 14:50:47 +0200 Subject: [PATCH] fix: add missing verbose mode flags (backport #4286) (#4287) * fix: add missing verbose mode flags (#4286) * add missing verbose mode flags * add changelog * remove unused debug flag (cherry picked from commit 3152cf5dcddf8062af2c21f70601e63d623bb597) # Conflicts: # ignite/cmd/chain_lint.go * Update changelog.md * remove unused file --------- Co-authored-by: Danilo Pantani --- changelog.md | 1 + ignite/cmd/chain_build.go | 2 +- ignite/cmd/chain_faucet.go | 5 +---- ignite/cmd/chain_init.go | 1 + ignite/cmd/chain_serve.go | 3 ++- ignite/cmd/cmd.go | 8 +++++++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/changelog.md b/changelog.md index 7dd3ba6ddb..150486832a 100644 --- a/changelog.md +++ b/changelog.md @@ -13,6 +13,7 @@ - [#4262](https://github.com/ignite/cli/pull/4262) Bring back relayer command - [#4269](https://github.com/ignite/cli/pull/4269) Add custom flag parser for extensions - [#4270](https://github.com/ignite/cli/pull/4270) Add flags to the extension hooks commands +- [#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) diff --git a/ignite/cmd/chain_build.go b/ignite/cmd/chain_build.go index 5299e915ee..6b89b0a6ca 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_faucet.go b/ignite/cmd/chain_faucet.go index 1e50122fd3..335d33d8fc 100644 --- a/ignite/cmd/chain_faucet.go +++ b/ignite/cmd/chain_faucet.go @@ -29,10 +29,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_init.go b/ignite/cmd/chain_init.go index 481146353f..0f61505fc3 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_serve.go b/ignite/cmd/chain_serve.go index 0eebc0a7d2..261d0fe5c9 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 78637ae950..a62e61d431 100644 --- a/ignite/cmd/cmd.go +++ b/ignite/cmd/cmd.go @@ -101,8 +101,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 }