diff --git a/changelog.md b/changelog.md index 573ddfa229..7239e22230 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,7 @@ - [#3959](https://github.com/ignite/cli/pull/3959) Remove app name prefix from the `.gitignore` file - [#3962](https://github.com/ignite/cli/pull/3962) Rename all RPC endpoints and autocli commands generated for `map`/`list`/`single` types +- [#3972](https://github.com/ignite/cli/pull/3972) Skip Ignite app loading for some base commands that don't allow apps ### Fixes diff --git a/ignite/cmd/cmd.go b/ignite/cmd/cmd.go index 4cf17ade67..b33d5c985d 100644 --- a/ignite/cmd/cmd.go +++ b/ignite/cmd/cmd.go @@ -5,6 +5,7 @@ import ( "fmt" "os" "path/filepath" + "slices" "sort" "strings" "time" @@ -39,6 +40,9 @@ const ( statusQuerying = "Querying..." ) +// List of CLI level one commands that should not load Ignite app instances. +var skipAppsLoadCommands = []string{"version", "help", "docs", "completion"} + // New creates a new root command for `Ignite CLI` with its sub commands. // Returns the cobra.Command, a cleanup function and an error. The cleanup // function must be invoked by the caller to clean eventual Ignite App instances. @@ -85,6 +89,11 @@ To get started, create a blockchain: ) c.AddCommand(deprecated()...) + // Don't load Ignite apps for level one commands that doesn't allow them + if len(os.Args) == 2 && slices.Contains(skipAppsLoadCommands, os.Args[1]) { + return c, func() {}, nil + } + // Load plugins if any session := cliui.New(cliui.WithStdout(os.Stdout)) if err := LoadPlugins(ctx, c, session); err != nil {