textwrap

package module
v0.0.0-...-497ff9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2026 License: GPL-3.0 Imports: 1 Imported by: 4

README

Golang Text Wrapper with Indent

GoDoc Build Status codecov

The textwrap Go package contains code to wrap and indent text.

For example:

import "github.com/bassosimone/textwrap"

const (
	indent = "    "
	width = 72
)
output := textwrap.Do(paragraph, width, indent)

The above example wraps paragraph with the given four spaces indent such that lines are <= 72 chars.

Installation

To add this package as a dependency to your module:

go get github.com/bassosimone/textwrap

Development

To run the tests:

go test -v .

To measure test coverage:

go test -v -cover .

License

SPDX-License-Identifier: GPL-3.0-or-later

History

Adapted from bassosimone/clip.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(text string, width int, indent string) string

Do wraps text to the given width with the specified indentation

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL