File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import (
1313)
1414
1515var UsageKey = "USAGE: "
16+ var LegacyUsageKey = "SUMMARY: "
1617
1718// helpCmd represents the help command
1819var helpCmd = & cobra.Command {
Original file line number Diff line number Diff line change @@ -54,11 +54,11 @@ func (s *Script) parse() error {
5454 return err
5555 }
5656
57- if strings .Contains (string (b ), UsageKey ) {
57+ if strings .Contains (string (b ), UsageKey ) || strings . Contains ( string ( b ), LegacyUsageKey ) {
5858 lines := strings .Split (string (b ), "\n " )
5959 var linesStart int
6060 for idx , line := range lines {
61- if strings .Contains (line , UsageKey ) {
61+ if strings .Contains (line , UsageKey ) || strings . Contains ( line , LegacyUsageKey ) {
6262 linesStart = idx
6363 break
6464 }
@@ -74,7 +74,7 @@ func (s *Script) parse() error {
7474 helpTextLines := lines [linesStart :helpEnds ]
7575 helpText := strings .Join (helpTextLines , "\n " )
7676
77- s .usage = strings .TrimSpace (strings .Split (lines [linesStart ], UsageKey )[1 ])
77+ s .usage = strings .TrimSpace (strings .SplitN (lines [linesStart ], ":" , 2 )[1 ])
7878 s .help = helpText
7979 }
8080 return nil
You can’t perform that action at this time.
0 commit comments