config

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() (*Config, Options)

func Update

func Update(settings []ComponentSettings, options Options)

Types

type ActionsConfig

type ActionsConfig struct {
	TerminalBell *bool   `yaml:"terminal-bell,omitempty"`
	Sound        *bool   `yaml:"sound,omitempty"`
	Visual       *bool   `yaml:"visual,omitempty"`
	Script       *string `yaml:"script,omitempty"`
}

type AsciiBoxConfig

type AsciiBoxConfig struct {
	ComponentConfig `yaml:",inline"`
	Item            `yaml:",inline"`
	Border          *bool              `yaml:"border,omitempty"`
	Font            *console.AsciiFont `yaml:"font,omitempty"`
}

type BarChartConfig

type BarChartConfig struct {
	ComponentConfig `yaml:",inline"`
	Scale           *int   `yaml:"scale,omitempty"`
	Items           []Item `yaml:"items"`
}

type ComponentConfig

type ComponentConfig struct {
	Title    string          `yaml:"title"`
	Position [][]int         `yaml:"position,flow"`
	RateMs   *int            `yaml:"rate-ms,omitempty"`
	Triggers []TriggerConfig `yaml:"triggers,omitempty"`
	Type     ComponentType   `yaml:",omitempty"`
}

func (*ComponentConfig) GetLocation

func (c *ComponentConfig) GetLocation() Location

func (*ComponentConfig) GetRectangle

func (c *ComponentConfig) GetRectangle() image.Rectangle

func (*ComponentConfig) GetSize

func (c *ComponentConfig) GetSize() Size

type ComponentSettings

type ComponentSettings struct {
	Type     ComponentType
	Title    string
	Size     Size
	Location Location
}

type ComponentType

type ComponentType rune
const (
	TypeRunChart  ComponentType = 0
	TypeBarChart  ComponentType = 1
	TypeSparkLine ComponentType = 2
	TypeTextBox   ComponentType = 3
	TypeAsciiBox  ComponentType = 4
	TypeGauge     ComponentType = 5
)

type Config

type Config struct {
	Theme      *console.Theme    `yaml:"theme,omitempty"`
	Variables  map[string]string `yaml:"variables,omitempty"`
	RunCharts  []RunChartConfig  `yaml:"runcharts,omitempty"`
	BarCharts  []BarChartConfig  `yaml:"barcharts,omitempty"`
	Gauges     []GaugeConfig     `yaml:"gauges,omitempty"`
	SparkLines []SparkLineConfig `yaml:"sparklines,omitempty"`
	TextBoxes  []TextBoxConfig   `yaml:"textboxes,omitempty"`
	AsciiBoxes []AsciiBoxConfig  `yaml:"asciiboxes,omitempty"`
}

type GaugeConfig

type GaugeConfig struct {
	ComponentConfig `yaml:",inline"`
	Scale           *int      `yaml:"scale,omitempty"`
	Color           *ui.Color `yaml:"color,omitempty"`
	PercentOnly     *bool     `yaml:"percent-only,omitempty"`
	Cur             Item      `yaml:"cur"`
	Max             Item      `yaml:"max"`
	Min             Item      `yaml:"min"`
}

type Item

type Item struct {
	Label               *string   `yaml:"label,omitempty"`
	Color               *ui.Color `yaml:"color,omitempty"`
	Pty                 *bool     `yaml:"pty,omitempty"`
	InitScript          *string   `yaml:"init,omitempty"`
	MultiStepInitScript *[]string `yaml:"multistep-init,omitempty"`
	SampleScript        *string   `yaml:"sample"`
	TransformScript     *string   `yaml:"transform,omitempty"`
}

type LegendConfig

type LegendConfig struct {
	Enabled bool `yaml:"enabled"`
	Details bool `yaml:"details"`
}

type Location

type Location struct {
	X int
	Y int
}

type Options

type Options struct {
	ConfigFile       *string  `short:"c" long:"config" description:"Path to YAML config file"`
	LicenseKey       *string  `short:"l" long:"license" description:"License key. Visit www.sampler.dev for details"`
	Environment      []string `` /* 182-byte string literal not displayed */
	Version          bool     `short:"v" long:"version" description:"Print version"`
	DisableTelemetry bool     `` /* 134-byte string literal not displayed */
}

Options with cli flags

type RunChartConfig

type RunChartConfig struct {
	ComponentConfig `yaml:",inline"`
	Legend          *LegendConfig `yaml:"legend,omitempty"`
	Scale           *int          `yaml:"scale,omitempty"`
	Items           []Item        `yaml:"items"`
}

type Size

type Size struct {
	X int
	Y int
}

type SparkLineConfig

type SparkLineConfig struct {
	ComponentConfig `yaml:",inline"`
	Scale           *int        `yaml:"scale,omitempty"`
	Item            Item        `yaml:",inline"`
	Gradient        *[]ui.Color `yaml:",omitempty"`
}

type TextBoxConfig

type TextBoxConfig struct {
	ComponentConfig `yaml:",inline"`
	Item            `yaml:",inline"`
	Border          *bool `yaml:"border,omitempty"`
}

type TriggerConfig

type TriggerConfig struct {
	Title     string         `yaml:"title"`
	Condition string         `yaml:"condition"`
	Actions   *ActionsConfig `yaml:"actions,omitempty"`
}

Jump to

Keyboard shortcuts

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