diff options
Diffstat (limited to 'vendor/github.com/mitchellh/go-wordwrap/README.md')
-rw-r--r-- | vendor/github.com/mitchellh/go-wordwrap/README.md | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/vendor/github.com/mitchellh/go-wordwrap/README.md b/vendor/github.com/mitchellh/go-wordwrap/README.md new file mode 100644 index 0000000..60ae311 --- /dev/null +++ b/vendor/github.com/mitchellh/go-wordwrap/README.md | |||
@@ -0,0 +1,39 @@ | |||
1 | # go-wordwrap | ||
2 | |||
3 | `go-wordwrap` (Golang package: `wordwrap`) is a package for Go that | ||
4 | automatically wraps words into multiple lines. The primary use case for this | ||
5 | is in formatting CLI output, but of course word wrapping is a generally useful | ||
6 | thing to do. | ||
7 | |||
8 | ## Installation and Usage | ||
9 | |||
10 | Install using `go get github.com/mitchellh/go-wordwrap`. | ||
11 | |||
12 | Full documentation is available at | ||
13 | http://godoc.org/github.com/mitchellh/go-wordwrap | ||
14 | |||
15 | Below is an example of its usage ignoring errors: | ||
16 | |||
17 | ```go | ||
18 | wrapped := wordwrap.WrapString("foo bar baz", 3) | ||
19 | fmt.Println(wrapped) | ||
20 | ``` | ||
21 | |||
22 | Would output: | ||
23 | |||
24 | ``` | ||
25 | foo | ||
26 | bar | ||
27 | baz | ||
28 | ``` | ||
29 | |||
30 | ## Word Wrap Algorithm | ||
31 | |||
32 | This library doesn't use any clever algorithm for word wrapping. The wrapping | ||
33 | is actually very naive: whenever there is whitespace or an explicit linebreak. | ||
34 | The goal of this library is for word wrapping CLI output, so the input is | ||
35 | typically pretty well controlled human language. Because of this, the naive | ||
36 | approach typically works just fine. | ||
37 | |||
38 | In the future, we'd like to make the algorithm more advanced. We would do | ||
39 | so without breaking the API. | ||