diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-03 13:09:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-03 13:09:55 +0000 |
commit | 8c7c9880b1adcf876ad63ea39e46e62bd7ebde5d (patch) | |
tree | f9c6369a6593e3c00cfb3c0b45009dfb6d055d7b /vendor/github.com/MichaelMure/go-term-text/Readme.md | |
parent | f5193cc76dd1a1c1bb55194a64ef90bae2278115 (diff) | |
parent | 912b5ca320891f2a4f1a88f1a137ce8ee46a1a03 (diff) | |
download | git-bug-8c7c9880b1adcf876ad63ea39e46e62bd7ebde5d.tar.gz |
Merge pull request #228 from ludovicm67/patch-cli-label-colors
Display label colors in termui
Diffstat (limited to 'vendor/github.com/MichaelMure/go-term-text/Readme.md')
-rw-r--r-- | vendor/github.com/MichaelMure/go-term-text/Readme.md | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/github.com/MichaelMure/go-term-text/Readme.md b/vendor/github.com/MichaelMure/go-term-text/Readme.md new file mode 100644 index 00000000..457b4472 --- /dev/null +++ b/vendor/github.com/MichaelMure/go-term-text/Readme.md @@ -0,0 +1,71 @@ +# go-term-text + +[![Build Status](https://travis-ci.org/MichaelMure/go-term-text.svg?branch=master)](https://travis-ci.org/MichaelMure/go-term-text) +[![GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text?status.svg)](https://godoc.org/github.com/MichaelMure/go-term-text) +[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelMure/go-term-text)](https://goreportcard.com/report/github.com/MichaelMure/go-term-text) +[![codecov](https://codecov.io/gh/MichaelMure/go-term-text/branch/master/graph/badge.svg)](https://codecov.io/gh/MichaelMure/go-term-text) +[![GitHub license](https://img.shields.io/github/license/MichaelMure/go-term-text.svg)](https://github.com/MichaelMure/go-term-text/blob/master/LICENSE) +[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/the-git-bug/Lobby) + +`go-term-text` is a go package implementing a collection of algorithms to help format and manipulate text for the terminal. + +In particular, `go-term-text`: +- support wide characters (chinese, japanese ...) and emoji +- handle properly ANSI escape sequences + +Included algorithms cover: +- wrapping with padding and indentation +- padding +- text length +- trimming +- alignment +- escape sequence extraction and reapplication +- truncation + +## Example + +```go +package main + +import ( + "fmt" + "strings" + + text "github.com/MichaelMure/go-term-text" +) + +func main() { + input := "The \x1b[1mLorem ipsum\x1b[0m text is typically composed of " + + "pseudo-Latin words. It is commonly used as \x1b[3mplaceholder\x1b[0m" + + " text to examine or demonstrate the \x1b[9mvisual effects\x1b[0m of " + + "various graphic design. 一只 A Quick \x1b[31m敏捷的狐 Fox " + + "狸跳过了\x1b[0mDog一只懒狗。" + + output, n := text.WrapWithPadIndent(input, 60, + "\x1b[34m<-indent-> \x1b[0m", "\x1b[33m<-pad-> \x1b[0m") + + fmt.Printf("output has %d lines\n\n", n) + + fmt.Println("|" + strings.Repeat("-", 58) + "|") + fmt.Println(output) + fmt.Println("|" + strings.Repeat("-", 58) + "|") +} +``` + +This will print: + +![example output](/img/example.png) + +For more details, have a look at the [GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text). + +## Origin + +This package has been extracted from the [git-bug](https://github.com/MichaelMure/git-bug) project. As such, its aim is to support this project and not to provide an all-in-one solution. Contributions as welcome though. + +## Contribute + +PRs accepted. + +## License + +MIT |