From 2e61fe7bd6eedb2889212114373cbf5920c61edc Mon Sep 17 00:00:00 2001 From: jeronimoalbi Date: Fri, 12 Jan 2024 10:09:31 +0100 Subject: [PATCH] chore: move commands definitions to a public function --- explorer/cmd/cmd.go | 26 ++++++++++++++------------ explorer/main.go | 2 +- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/explorer/cmd/cmd.go b/explorer/cmd/cmd.go index fd0f07ee..9bd0da7f 100644 --- a/explorer/cmd/cmd.go +++ b/explorer/cmd/cmd.go @@ -2,18 +2,20 @@ package cmd import "github.com/ignite/cli/v28/ignite/services/plugin" -// Commands contains the list of app commands. -var Commands = []*plugin.Command{ - { - Use: "explorer [command]", - Short: "Run chain explorer commands", - Aliases: []string{"e"}, - Commands: []*plugin.Command{ - { - Use: "gex [rpc_url]", - Short: "Run gex", - Aliases: []string{"g"}, +// GetCommands returns the list of explorer app commands. +func GetCommands() []*plugin.Command { + return []*plugin.Command{ + { + Use: "explorer [command]", + Short: "Run chain explorer commands", + Aliases: []string{"e"}, + Commands: []*plugin.Command{ + { + Use: "gex [rpc_url]", + Short: "Run gex", + Aliases: []string{"g"}, + }, }, }, - }, + } } diff --git a/explorer/main.go b/explorer/main.go index d9472774..6b17260e 100644 --- a/explorer/main.go +++ b/explorer/main.go @@ -15,7 +15,7 @@ type app struct{} func (app) Manifest(context.Context) (*plugin.Manifest, error) { return &plugin.Manifest{ Name: "explorer", - Commands: cmd.Commands, + Commands: cmd.GetCommands(), }, nil }