config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDefaultConfig

func CopyDefaultConfig() error

Types

type Config

type Config struct {
	PomodoroDuration time.Duration `mapstructure:"pomodoro_duration"`
	BreakDuration    time.Duration `mapstructure:"break_duration"`
	RefreshRate      time.Duration `mapstructure:"refresh_rate"`
	LockFile         string        `mapstructure:"lock_file"`
	Outputs          OutputsConfig `mapstructure:"outputs"`
}

func ReadConfig

func ReadConfig(configPath string) (*Config, error)

type FileConfig

type FileConfig struct {
	Path string `mapstructure:"path"`
}

func (FileConfig) Instantiate

func (c FileConfig) Instantiate() *outputs.Output

func (*FileConfig) IsActivated

func (c *FileConfig) IsActivated() bool

type OutputConfig

type OutputConfig interface {
	IsActivated() bool
	Instantiate() *outputs.Output
}

type OutputsConfig

type OutputsConfig struct {
	Stdout *StdoutConfig `mapstructure:"stdout"`
	File   *FileConfig   `mapstructure:"file"`
	Slack  *SlackConfig  `mapstructure:"slack"`
}

func DefaultOutputsConfig

func DefaultOutputsConfig() OutputsConfig

func (OutputsConfig) GetOutputsConfig

func (o OutputsConfig) GetOutputsConfig() []OutputConfig

type SlackConfig added in v0.2.0

type SlackConfig struct {
	Token        string `mapstructure:"token"`
	DoNotDisturb bool   `mapstructure:"do_not_disturb"`
	Emoji        string `mapstructure:"emoji"`
}

func (SlackConfig) Instantiate added in v0.2.0

func (c SlackConfig) Instantiate() *outputs.Output

func (*SlackConfig) IsActivated added in v0.2.0

func (c *SlackConfig) IsActivated() bool

type StdoutConfig

type StdoutConfig struct {
	ShowPercent bool `mapstructure:"show_percent"`
	Size        int  `mapstructure:"size"`
}

func (StdoutConfig) Instantiate

func (c StdoutConfig) Instantiate() *outputs.Output

func (*StdoutConfig) IsActivated

func (c *StdoutConfig) IsActivated() bool

Jump to

Keyboard shortcuts

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