colorize

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyReplace

func CopyReplace(dst io.Writer, src io.Reader, regexes []*Colorize) (written int64, err error)

func Spawn

func Spawn(colors []*Colorize, cmd string, args ...string) error

func StringToAttributes

func StringToAttributes(colorStr string) ([]color.Attribute, error)

Converts a comma separated list of colors into color.Attributes

Types

type Colorize

type Colorize struct {
	Regexp   *Regexp `yaml:"regex"`
	ColorStr string  `yaml:"color"`
	Replace  []byte
	// contains filtered or unexported fields
}

The colorize struct contains a regex to match and the teminal color to replace to

func NewColorize

func NewColorize(re string, colorStr string) (*Colorize, error)

func (*Colorize) Color

func (c *Colorize) Color() *color.Color

func (*Colorize) Init

func (c *Colorize) Init() error

type Regexp

type Regexp struct {
	*regexp.Regexp
}

a Marshallable Regexp

func (*Regexp) MarshalYAML

func (re *Regexp) MarshalYAML() (interface{}, error)

implements the yaml.Marshaler interface for Regexp

func (*Regexp) UnmarshalYAML

func (re *Regexp) UnmarshalYAML(unmarshal func(interface{}) error) error

implements the yaml.Unmarshaler interface for Regexp

Jump to

Keyboard shortcuts

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