Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 992b583

Browse files
authored
fix: Use the cobra CommandPath for usage to avoid duplication (#1617)
1 parent adb7d20 commit 992b583

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,6 @@ func versionTemplate() string {
264264

265265
// FormatCobraError colorizes and adds "--help" docs to cobra commands.
266266
func FormatCobraError(err error, cmd *cobra.Command) string {
267-
helpErrMsg := fmt.Sprintf("Run '%s %s --help' for usage.", cmd.Root().Name(), cmd.Name())
267+
helpErrMsg := fmt.Sprintf("Run '%s --help' for usage.", cmd.CommandPath())
268268
return cliui.Styles.Error.Render(err.Error() + "\n" + helpErrMsg)
269269
}

0 commit comments

Comments
 (0)