Skip to content

Commit

Permalink
better example with bar + bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Dec 8, 2014
1 parent 382357b commit 776bd23
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion draw.go
Expand Up @@ -64,7 +64,18 @@ func DrawTextFormatBytes(progress, total int64) string {
}

// DrawTextFormatBar returns a DrawTextFormatFunc that draws a progress
// bar with the given width (in characters).
// bar with the given width (in characters). This can be used in conjunction
// with another DrawTextFormatFunc to create a progress bar with bytes, for
// example:
//
// bar := DrawTextFormatBar(20)
// func(progress, total int64) string {
// return fmt.Sprintf(
// "%s %s",
// bar(progress, total),
// DrawTextFormatBytes(progress, total))
// }
//
func DrawTextFormatBar(width int64) DrawTextFormatFunc {
width -= 2

Expand Down

0 comments on commit 776bd23

Please sign in to comment.