Skip to content

Commit

Permalink
Fixed documentation styling
Browse files Browse the repository at this point in the history
Fixed indentation and the like.
  • Loading branch information
mdm-code committed Jan 23, 2023
1 parent 89e30c3 commit 5556106
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions cmd/tcols/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ Tcols reads text from a file and writes the colorized text to the standard
output.
Usage:
tcols [-s|--style arg...] [file...]
Options:
-h, --help show this help message and exit
-s, --style list of styles and colors to apply to text
Example:
tcols -style 'bold bluefg' < <(echo -n 'Hello, world!')
Output:
Raw: \033[1m\033[34mHello, World!\033[0m
The program returns text read from a file with Select Graphic Rendition control
Expand Down
28 changes: 14 additions & 14 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ implemented to simplify the terminal tcols command.
# Usage
package main
package main
import (
"fmt"
import (
"fmt"
"github.com/mdm-code/termcols"
)
func main() {
s := termcols.Colorize(
"Colorized text!",
termcols.RedFg,
termcols.Underline,
termcols.Rgb24(termcols.BG, 120, 255, 54),
"github.com/mdm-code/termcols"
)
fmt.Println(s)
}
func main() {
s := termcols.Colorize(
"Colorized text!",
termcols.RedFg,
termcols.Underline,
termcols.Rgb24(termcols.BG, 120, 255, 54),
)
fmt.Println(s)
}
[Wikipedia ANSI]: https://en.wikipedia.org/wiki/ANSI_escape_code
*/
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

// ExampleColorize shows how to use termcols public API Colorize function.
// It uses a combination of style, foreground and colors to stylize the
// ``Colorize text\!'' string.
// Colorize text\! string.
func ExampleColorize() {
s := termcols.Colorize(
"Colorized text!",
Expand Down
8 changes: 4 additions & 4 deletions mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ var (
// come in one of the case-insensitive patterns listed below. Otherwise the
// function returns an empty slice and errMap.
//
// RGB 8 : rgb8=[fg|bg]:[0-255]
// RGB 24 : rgb24=[fg|bg]:[0-255]:[0-255]:[0-255]
// RGB 8 : rgb8=[fg|bg]:[0-255]
// RGB 24 : rgb24=[fg|bg]:[0-255]:[0-255]:[0-255]
func MapColors(ss []string) ([]SgrAttr, error) {
result := make([]SgrAttr, 0, 3)
for _, s := range ss {
Expand All @@ -93,8 +93,8 @@ func MapColors(ss []string) ([]SgrAttr, error) {
// one of the case-insensitive patterns listed below. Otherwise the function
// returns an empty string of type SgrAttr and errMap.
//
// RGB 8 : rgb8=[fg|bg]:[0-255]
// RGB 24 : rgb24=[fg|bg]:[0-255]:[0-255]:[0-255]
// RGB 8 : rgb8=[fg|bg]:[0-255]
// RGB 24 : rgb24=[fg|bg]:[0-255]:[0-255]:[0-255]
func MapColor(s string) (SgrAttr, error) {
col, ok := colorMap[strings.ToLower(s)]
if ok {
Expand Down

0 comments on commit 5556106

Please sign in to comment.