Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
github.com/mitchellh/go-wordwrap
go-wordwrap
(Golang package: wordwrap
) is a package for Go that
automatically wraps words into multiple lines. The primary use case for this
is in formatting CLI output, but of course word wrapping is a generally useful
thing to do.
Install using go get github.com/mitchellh/go-wordwrap
.
Full documentation is available at http://godoc.org/github.com/mitchellh/go-wordwrap
Below is an example of its usage ignoring errors:
wrapped := wordwrap.WrapString("foo bar baz", 3)
fmt.Println(wrapped)
Would output:
foo
bar
baz
This library doesn't use any clever algorithm for word wrapping. The wrapping is actually very naive: whenever there is whitespace or an explicit linebreak. The goal of this library is for word wrapping CLI output, so the input is typically pretty well controlled human language. Because of this, the naive approach typically works just fine.
In the future, we'd like to make the algorithm more advanced. We would do so without breaking the API.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.