config

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParseErr    = "$_parseErr"
	TextPayload = "message"
)
View Source
const (
	TypeString   = "string"
	TypeBool     = "bool"
	TypeNumber   = "number"
	TypeDateTime = "datetime"
)

Variables

This section is empty.

Functions

func GetBackgroundColorName

func GetBackgroundColorName(colorable func() *Color, colorIfNone string) string

func GetForegroundColorName

func GetForegroundColorName(colorable func() *Color, colorIfNone string) string

Types

type Color

type Color struct {
	Foreground string `json:"foreground" yaml:"foreground"`
	Background string `json:"background" yaml:"background"`
}

func (*Color) GetBackgroundColor

func (c *Color) GetBackgroundColor() tcell.Color

func (*Color) GetForegroundColor

func (c *Color) GetForegroundColor() tcell.Color

func (*Color) SetTextTagColor

func (c *Color) SetTextTagColor(text string) string

type ColorWhen

type ColorWhen struct {
	MatchValue string `json:"match-value" yaml:"match-value,omitempty"`
	Color      Color  `json:"color" yaml:"color,omitempty"`
}

type Config

type Config struct {
	Keys          []Key  `json:"keys" yaml:"keys"`
	LastSavedName string `json:"-" yaml:"-"`
}

func MakeConfig

func MakeConfig(file string) (*Config, error)

func MakeConfigFromSample

func MakeConfigFromSample(sample []map[string]interface{}, mergeWith ...Key) (*Config, map[string]*Key)

func (*Config) KeyMap added in v0.2.10

func (c *Config) KeyMap() map[string]*Key

func (*Config) Save

func (c *Config) Save(fileName string) error

type Key

type Key struct {
	Name      string      `json:"name" yaml:"name"`
	Type      Type        `json:"type" yaml:"type"`
	Layout    string      `json:"layout,omitempty" yaml:"layout,omitempty"`
	Color     Color       `json:"color,omitempty" yaml:"color,omitempty"`
	MaxWidth  int         `json:"max-width,omitempty" yaml:"max-width"`
	ColorWhen []ColorWhen `json:"color-when,omitempty" yaml:"color-when,omitempty"`
}

func (*Key) ExtractValue

func (k *Key) ExtractValue(m map[string]interface{}) string

type Match

type Match struct {
	Value string `json:"value" yaml:"value,omitempty"`
	Color Color  `json:"color" yaml:"color,omitempty"`
}

type Type

type Type string

func (Type) GetColor

func (t Type) GetColor() tcell.Color

func (Type) GetColorName

func (t Type) GetColorName() string

Jump to

Keyboard shortcuts

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