config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCommand = errors.New("empty command")
)

Functions

This section is empty.

Types

type CheckType

type CheckType string
const (
	CheckTypeCommand CheckType = "command"
	CheckTypeHTTP    CheckType = "http"
)

type Color

type Color struct {
	// contains filtered or unexported fields
}

func (*Color) Get

func (c *Color) Get() interface{}

Satisfy the flag package Getter interface.

func (*Color) Set

func (c *Color) Set(s string) error

Satisfy the flag package Value interface.

func (*Color) SetInt

func (c *Color) SetInt(i int) error

func (*Color) SetString

func (c *Color) SetString(s string) error

func (*Color) Type

func (c *Color) Type() string

Satisfy the pflag package Value interface.

func (*Color) UnmarshalText

func (c *Color) UnmarshalText(text []byte) error

Satisfy the encoding.TextUnmarshaler interface.

func (Color) Validate

func (c Color) Validate() error

type Config

type Config struct {
	Raw              bool         `mapstructure:"raw"`
	KillOthers       bool         `mapstructure:"killOthers"`
	KillOthersOnFail bool         `mapstructure:"killOthersOnFail"`
	KillSignal       KillSignal   `mapstructure:"killSignal"`
	Debug            bool         `mapstructure:"debug"`
	Prefix           PrefixConfig `mapstructure:"prefix"`
	Commands         []RunCommandConfig
	Status           StatusConfig
	RunBefore        RunBeforeConfig
	RunAfter         RunAfterConfig
}

func ParseConfig

func ParseConfig() (*Config, error)

func (Config) PrintDebug

func (c Config) PrintDebug()

func (Config) Validate

func (c Config) Validate() error

type InputType

type InputType string
const (
	InputTypeStdin    InputType = "stdin"
	InputTypePrevious InputType = "previous"
	InputTypeNone     InputType = "none"
)

func (InputType) Validate

func (i InputType) Validate() error

type KillSignal

type KillSignal syscall.Signal

func (*KillSignal) Get

func (s *KillSignal) Get() interface{}

Satisfy the flag package Getter interface.

func (*KillSignal) Set

func (s *KillSignal) Set(str string) error

Satisfy the flag package Value interface.

func (KillSignal) Sys

func (c KillSignal) Sys() syscall.Signal

func (*KillSignal) Type

func (s *KillSignal) Type() string

Satisfy the pflag package Value interface.

func (*KillSignal) UnmarshalText

func (s *KillSignal) UnmarshalText(text []byte) error

Satisfy the encoding.TextUnmarshaler interface.

func (KillSignal) Validate

func (c KillSignal) Validate() error

type OutputType

type OutputType string
const (
	OutputTypeStdout   OutputType = "stdout"
	OutputTypePrevious OutputType = "previous"
	OutputTypeNone     OutputType = "none"
)

func (OutputType) Validate

func (i OutputType) Validate() error

type PrefixConfig

type PrefixConfig struct {
	Template        string `mapstructure:"template"`
	PadPrefix       bool   `mapstructure:"padPrefix"`
	PrefixLength    int    `mapstructure:"prefixLength"`
	TimestampFormat string `mapstructure:"timestampFormat"`
	TimeSinceStart  bool   `mapstructure:"timeSinceStart"`
}

type RunAfterCommandConfig

type RunAfterCommandConfig struct {
	RunCommandConfig `mapstructure:",squash"`
}

func (RunAfterCommandConfig) Validate

func (c RunAfterCommandConfig) Validate() error

type RunAfterConfig

type RunAfterConfig struct {
	Commands []RunAfterCommandConfig `mapstructure:"commands"`
}

func (RunAfterConfig) Validate

func (c RunAfterConfig) Validate() error

type RunBeforeCommandConfig

type RunBeforeCommandConfig struct {
	RunCommandConfig `mapstructure:",squash"`
}

func (RunBeforeCommandConfig) Validate

func (c RunBeforeCommandConfig) Validate() error

type RunBeforeConfig

type RunBeforeConfig struct {
	Commands []RunBeforeCommandConfig `mapstructure:"commands"`
}

func (RunBeforeConfig) Validate

func (c RunBeforeConfig) Validate() error

type RunCommandConfig

type RunCommandConfig struct {
	Command     string   `mapstructure:"command"`
	Name        string   `mapstructure:"name"`
	PrefixColor Sequence `mapstructure:",squash"`
	CWD         string   `mapstructure:"cwd"`
	Debug       bool     `mapstructure:"debug"`
}

func (RunCommandConfig) Validate

func (c RunCommandConfig) Validate() error

type Sequence

type Sequence struct {
	Color     Color
	Bold      bool
	Underline bool
}

func (Sequence) Apply

func (c Sequence) Apply(str string) string

func (Sequence) Validate

func (c Sequence) Validate() error

type StatusCheckConfig

type StatusCheckConfig struct {
	Type     CheckType     `mapstructure:"type"`
	Interval time.Duration `mapstructure:"interval"`
	Command  string        `mapstructure:"command"`
	URL      string        `mapstructure:"url"`
	Template string        `mapstructure:"template"`
}

func (StatusCheckConfig) Validate

func (c StatusCheckConfig) Validate() error

type StatusConfig

type StatusConfig struct {
	Enabled       bool                `mapstructure:"enabled"`
	PrintInterval time.Duration       `mapstructure:"printInterval"`
	Sequence      Sequence            `mapstructure:",squash"`
	Text          string              `mapstructure:"text"`
	Checks        []StatusCheckConfig `mapstructure:"checks"`
}

func (StatusConfig) Validate

func (c StatusConfig) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳