diff --git a/core/arg_specs.go b/core/arg_specs.go index ba84a63052..c554b3625e 100644 --- a/core/arg_specs.go +++ b/core/arg_specs.go @@ -133,6 +133,10 @@ func (a *ArgSpec) ConflictWith(b *ArgSpec) bool { (a.OneOfGroup == b.OneOfGroup) } +func (a *ArgSpec) DebugString() string { + return a.Name +} + type DefaultFunc func(ctx context.Context) (value string, doc string) func ZoneArgSpec(zones ...scw.Zone) *ArgSpec { diff --git a/core/autocomplete.go b/core/autocomplete.go index d2ceecfd1f..a4993116bc 100644 --- a/core/autocomplete.go +++ b/core/autocomplete.go @@ -169,6 +169,10 @@ func (node *AutoCompleteNode) GetChildMatch(name string) (*AutoCompleteNode, boo return nil, false } +func (node *AutoCompleteNode) DebugString() string { + return node.Name +} + func (node *AutoCompleteNode) addFlags(flags []FlagSpec) { for i := range flags { flag := &flags[i] diff --git a/core/bootstrap.go b/core/bootstrap.go index f8dcf9ff2e..2a9883a23a 100644 --- a/core/bootstrap.go +++ b/core/bootstrap.go @@ -6,6 +6,7 @@ import ( "io" "net/http" "os" + "strings" "github.com/scaleway/scaleway-cli/v2/internal/account" cliConfig "github.com/scaleway/scaleway-cli/v2/internal/config" @@ -302,3 +303,7 @@ func Bootstrap(config *BootstrapConfig) (exitCode int, result any, err error) { return 0, meta.result, nil } + +func (config *BootstrapConfig) DebugString() string { + return strings.Join(config.Args, " ") +} diff --git a/core/command.go b/core/command.go index 136c9e6614..805d220558 100644 --- a/core/command.go +++ b/core/command.go @@ -182,6 +182,10 @@ func (c *Command) Copy() *Command { return &newCommand } +func (c *Command) DebugString() string { + return c.getPath() +} + // get a signature to sort commands func (c *Command) signature() string { return c.Namespace + " " + c.Resource + " " + c.Verb + " " + c.Short diff --git a/core/testing.go b/core/testing.go index 2d6fafa8f7..015ad316fd 100644 --- a/core/testing.go +++ b/core/testing.go @@ -223,6 +223,10 @@ type TestConfig struct { EnableAliases bool } +func (config *TestConfig) DebugString() string { + return config.Cmd +} + // getTestFilePath returns a valid filename path based on the go test name and suffix. (Take care of non fs friendly char) func getTestFilePath(t *testing.T, suffix string) string { t.Helper()