Skip to content

Commit

Permalink
Wrap command long description
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse van den Kieboom committed Aug 26, 2013
1 parent 6b83057 commit 1c98f1f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func (p *Parser) WriteHelp(writer io.Writer) {
}

wr := bufio.NewWriter(writer)
aligninfo := p.getAlignmentInfo()

if p.ApplicationName != "" {
wr.WriteString("Usage:\n")
Expand All @@ -190,12 +191,15 @@ func (p *Parser) WriteHelp(writer io.Writer) {

if p.currentCommand != nil && len(p.currentCommand.LongDescription) != 0 {
fmt.Fprintln(wr)
fmt.Fprintln(wr, p.currentCommand.LongDescription)

t := wrapText(p.currentCommand.LongDescription,
aligninfo.terminalColumns,
"")

fmt.Fprintln(wr, t)
}
}

aligninfo := p.getAlignmentInfo()

seen := make(map[*Group]bool)

writeHelp := func(index int, grp *Group) {
Expand Down

0 comments on commit 1c98f1f

Please sign in to comment.