Remove extra newline when message contains trailing newlines. (#387)

This commit is contained in:
Mitar
2024-07-05 14:52:45 +02:00
committed by GitHub
parent e864bb0220
commit 5f9c5cc822
2 changed files with 19 additions and 6 deletions
+1 -1
View File
@@ -373,7 +373,7 @@ func (k *Kong) applyHookToDefaultFlags(ctx *Context, node *Node, name string) er
}
func formatMultilineMessage(w io.Writer, leaders []string, format string, args ...interface{}) {
lines := strings.Split(fmt.Sprintf(format, args...), "\n")
lines := strings.Split(strings.TrimRight(fmt.Sprintf(format, args...), "\n"), "\n")
leader := ""
for _, l := range leaders {
if l == "" {