sampler: github.com/sqshq/sampler/config Index | Files

package config

import "github.com/sqshq/sampler/config"

Index

Package Files

arrangement.go component.go config.go default.go options.go validator.go

func LoadConfig Uses

func LoadConfig() (*Config, Options)

func Update Uses

func Update(settings []ComponentSettings, options Options)

type ActionsConfig Uses

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 Uses

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

type BarChartConfig Uses

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

type ComponentConfig Uses

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 Uses

func (c *ComponentConfig) GetLocation() Location

func (*ComponentConfig) GetRectangle Uses

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

func (*ComponentConfig) GetSize Uses

func (c *ComponentConfig) GetSize() Size

type ComponentSettings Uses

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

type ComponentType Uses

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

type Config Uses

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 Uses

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 Uses

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 Uses

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

type Location Uses

type Location struct {
    X   int
    Y   int
}

type Options Uses

type Options struct {
    ConfigFile  *string  `short:"c" long:"config" description:"Path to YAML config file"`
    Environment []string `short:"e" long:"env" description:"Specify name=value variable to use in script placeholder as $name. This flag takes precedence over the same name variables, specified in config yml"`
    Version     bool     `short:"v" long:"version" description:"Print version"`
}

Options with cli flags

type RunChartConfig Uses

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

type Size Uses

type Size struct {
    X   int
    Y   int
}

type SparkLineConfig Uses

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

type TextBoxConfig Uses

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

type TriggerConfig Uses

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

Package config imports 9 packages (graph) and is imported by 11 packages. Updated 2020-01-03. Refresh now. Tools for package owners.