From 992b58389beb9c1166e8f2ff490cdc07d2b8841a Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Fri, 20 May 2022 12:42:56 +0300 Subject: [PATCH] fix: Use the cobra CommandPath for usage to avoid duplication (#1617) --- cli/root.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/root.go b/cli/root.go index a0e0a38956..00c7b6f0ce 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) }