styledprinter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package styledprinter helps to do some pretty-printing of text in terminal using ANSI escape sequences

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(message string, newLine bool)

Write prints a list of messages, one per line, with an optionnal end-of-line at the end

func WriteBlock

func WriteBlock(message string, padding string, baseStyle string, newLine bool)

WriteBlock prints a block of text using a string padding, with optionnal styles

Types

type OutputStyle

type OutputStyle struct {
	// contains filtered or unexported fields
}

OutputStyle is a structure that can add ANSI codes on a string from a legible style string.

func NewOutputStyle

func NewOutputStyle(styleString string) *OutputStyle

NewOutputStyle instanciates an OutputStyle struct from a style string.

func (OutputStyle) Apply

func (s OutputStyle) Apply(text string) string

Apply surrounds a given string with the adequate ANSI escape sequence.

Jump to

Keyboard shortcuts

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