From 4909975b16ed95141b525a49537ccafb9e04fe9c Mon Sep 17 00:00:00 2001 From: Juan Tirado Date: Wed, 5 Apr 2023 16:28:03 +0200 Subject: [PATCH 1/2] Print examples from info in the help command. --- cmd.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd.go b/cmd.go index b17695d4..d7504ae1 100644 --- a/cmd.go +++ b/cmd.go @@ -371,6 +371,10 @@ func (i *Info) HelpWithSuperFlags(superF *gnuflag.FlagSet, f *gnuflag.FlagSet) [ if len(i.Aliases) > 0 { fmt.Fprintf(buf, "\nAliases: %s\n", strings.Join(i.Aliases, ", ")) } + if len(i.Examples) > 0 { + fmt.Fprintf(buf, "\nExamples:\n%s\n", i.Examples) + } + return buf.Bytes() } From 53874817e4d585ffecb2e72bfb8f3628de677f5d Mon Sep 17 00:00:00 2001 From: Juan Tirado Date: Wed, 5 Apr 2023 16:40:55 +0200 Subject: [PATCH 2/2] Print examples field in the generic help command. --- cmd.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd.go b/cmd.go index d7504ae1..6b1b08b9 100644 --- a/cmd.go +++ b/cmd.go @@ -372,7 +372,7 @@ func (i *Info) HelpWithSuperFlags(superF *gnuflag.FlagSet, f *gnuflag.FlagSet) [ fmt.Fprintf(buf, "\nAliases: %s\n", strings.Join(i.Aliases, ", ")) } if len(i.Examples) > 0 { - fmt.Fprintf(buf, "\nExamples:\n%s\n", i.Examples) + fmt.Fprintf(buf, "\nExamples:\n%s", i.Examples) } return buf.Bytes()