Documentation ¶
Index ¶
- Constants
- type FileRule
- type Highlighter
- func (h *Highlighter) AddSimpleRangeRules(patternStart, colorsStart, patternEnd, colorsEnd string) error
- func (h *Highlighter) AddSimpleRule(pattern, colorsStr string) error
- func (h *Highlighter) DefaultAfter() int
- func (h *Highlighter) DefaultBefore() int
- func (h *Highlighter) DefaultHide() bool
- func (h *Highlighter) IgnoreCase() bool
- func (h *Highlighter) LoadToml(ruleFile string) error
- func (h *Highlighter) MatcherFlags() matcher.Flags
- func (h *Highlighter) MustAddSimpleRangeRules(patternStart, colorsStart, patternEnd, colorsEnd string)
- func (h *Highlighter) MustAddSimpleRule(pattern, colorsStr string)
- func (h *Highlighter) NewRule() *Rule
- func (h *Highlighter) NewRuntime(wr io.Writer) *Runtime
- func (h *Highlighter) NoSkipMarker() bool
- func (h *Highlighter) SetDefaultAfter(defaultAfter int)
- func (h *Highlighter) SetDefaultBefore(defaultBefore int)
- func (h *Highlighter) SetDefaultHide(defaultHide bool)
- func (h *Highlighter) SetIgnoreCase(ignoreCase bool)
- func (h *Highlighter) SetNoSkipMarker(noSkipMarker bool)
- func (h *Highlighter) Term() term.Term
- type Rule
- func (r *Rule) MustSetLineColorsString(colorsStr string)
- func (r *Rule) MustSetMatchColorsString(colorsStr string)
- func (r *Rule) MustSetMatcherString(pattern string)
- func (r *Rule) MustSetPostLineString(marker, colorsStr string)
- func (r *Rule) MustSetPreLineString(marker, colorsStr string)
- func (r *Rule) MustSetPreMatcherString(pattern string)
- func (r *Rule) SetAfter(n int)
- func (r *Rule) SetBefore(n int)
- func (r *Rule) SetHide(v bool)
- func (r *Rule) SetLineColorsString(colorsStr string) error
- func (r *Rule) SetMatchColorsString(colorsStr string) error
- func (r *Rule) SetMatcherString(pattern string) error
- func (r *Rule) SetNextState(s string)
- func (r *Rule) SetPostLineString(marker, colorsStr string) error
- func (r *Rule) SetPreLineString(marker, colorsStr string) error
- func (r *Rule) SetPreMatcherString(pattern string) error
- func (r *Rule) SetShow(v bool)
- func (r *Rule) SetStates(states []string)
- func (r *Rule) SetStop(v bool)
- type RuleFile
- type Runtime
Constants ¶
View Source
const InitialState = "INIT"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileRule ¶
type FileRule struct { Pattern string `toml:"pattern"` When string `toml:"when"` Colors string `toml:"color"` LineColors string `toml:"line_color"` PreLine string `toml:"pre_line"` PreLineColors string `toml:"pre_line_color"` PostLine string `toml:"post_line"` PostLineColors string `toml:"post_line_color"` Show bool `toml:"show"` Hide bool `toml:"hide"` Stop bool `toml:"stop"` NextState string `toml:"next_state"` States []string `toml:"states"` After int `toml:"after"` Before int `toml:"before"` }
type Highlighter ¶
type Highlighter struct {
// contains filtered or unexported fields
}
Highlighter defines a highlighter specification. Use NewHighlighter() or NewHighlighterWithTerm() to create a new instance.
func NewHighlighter ¶
func NewHighlighter() *Highlighter
NewHighlighter creates a new Highlighter instance with the auto-detected Term.
func NewHighlighterWithTerm ¶
func NewHighlighterWithTerm(t term.Term) *Highlighter
NewHighlighter creates a new Highlighter instance with a given Term.
func (*Highlighter) AddSimpleRangeRules ¶
func (h *Highlighter) AddSimpleRangeRules(patternStart, colorsStart, patternEnd, colorsEnd string) error
func (*Highlighter) AddSimpleRule ¶
func (h *Highlighter) AddSimpleRule(pattern, colorsStr string) error
func (*Highlighter) DefaultAfter ¶
func (h *Highlighter) DefaultAfter() int
func (*Highlighter) DefaultBefore ¶
func (h *Highlighter) DefaultBefore() int
func (*Highlighter) DefaultHide ¶
func (h *Highlighter) DefaultHide() bool
func (*Highlighter) IgnoreCase ¶
func (h *Highlighter) IgnoreCase() bool
func (*Highlighter) LoadToml ¶
func (h *Highlighter) LoadToml(ruleFile string) error
func (*Highlighter) MatcherFlags ¶
func (h *Highlighter) MatcherFlags() matcher.Flags
func (*Highlighter) MustAddSimpleRangeRules ¶
func (h *Highlighter) MustAddSimpleRangeRules(patternStart, colorsStart, patternEnd, colorsEnd string)
func (*Highlighter) MustAddSimpleRule ¶
func (h *Highlighter) MustAddSimpleRule(pattern, colorsStr string)
func (*Highlighter) NewRule ¶
func (h *Highlighter) NewRule() *Rule
func (*Highlighter) NewRuntime ¶
func (h *Highlighter) NewRuntime(wr io.Writer) *Runtime
NewRuntime creates a new Runtime. Output will be written to wr.
func (*Highlighter) NoSkipMarker ¶
func (h *Highlighter) NoSkipMarker() bool
func (*Highlighter) SetDefaultAfter ¶
func (h *Highlighter) SetDefaultAfter(defaultAfter int)
func (*Highlighter) SetDefaultBefore ¶
func (h *Highlighter) SetDefaultBefore(defaultBefore int)
func (*Highlighter) SetDefaultHide ¶
func (h *Highlighter) SetDefaultHide(defaultHide bool)
func (*Highlighter) SetIgnoreCase ¶
func (h *Highlighter) SetIgnoreCase(ignoreCase bool)
func (*Highlighter) SetNoSkipMarker ¶
func (h *Highlighter) SetNoSkipMarker(noSkipMarker bool)
func (*Highlighter) Term ¶
func (h *Highlighter) Term() term.Term
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
func (*Rule) MustSetLineColorsString ¶
func (*Rule) MustSetMatchColorsString ¶
func (*Rule) MustSetMatcherString ¶
func (*Rule) MustSetPostLineString ¶
func (*Rule) MustSetPreLineString ¶
func (*Rule) MustSetPreMatcherString ¶
func (*Rule) SetLineColorsString ¶
func (*Rule) SetMatchColorsString ¶
func (*Rule) SetMatcherString ¶
func (*Rule) SetNextState ¶
func (*Rule) SetPostLineString ¶
func (*Rule) SetPreLineString ¶
func (*Rule) SetPreMatcherString ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime defines a Highlighter execution highlighter. Multiple Runtime's can be created for the same Highlighter instance.
func (*Runtime) ColorBytes ¶
ColorBytes applies filter on a given byte array and write to wr.
func (*Runtime) ColorReader ¶
ColorReader reads from rd and applies filter on the output.
Click to show internal directories.
Click to hide internal directories.