From 2ee291b59b3cd7f660a033935b60fe2b637e8965 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Fri, 20 May 2022 09:11:35 +0000 Subject: [PATCH] fix: Use the cobra CommandPath for usage to avoid duplication --- cli/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/root.go b/cli/root.go index a0e0a389561ed..00c7b6f0ce531 100644 --- a/cli/root.go +++ b/cli/root.go @@ -264,6 +264,6 @@ func versionTemplate() string { // FormatCobraError colorizes and adds "--help" docs to cobra commands. func FormatCobraError(err error, cmd *cobra.Command) string { - helpErrMsg := fmt.Sprintf("Run '%s %s --help' for usage.", cmd.Root().Name(), cmd.Name()) + helpErrMsg := fmt.Sprintf("Run '%s --help' for usage.", cmd.CommandPath()) return cliui.Styles.Error.Render(err.Error() + "\n" + helpErrMsg) }