config

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "v1.4.2"

Variables

View Source
var (
	ColorMain       = lipgloss.AdaptiveColor{Light: "234", Dark: "15"}
	ColorSecondary  = lipgloss.AdaptiveColor{Light: "234", Dark: "7"}
	ColorWork       = lipgloss.AdaptiveColor{Light: "2", Dark: "10"}
	ColorShortBreak = lipgloss.AdaptiveColor{Light: "4", Dark: "12"}
	ColorLongBreak  = lipgloss.AdaptiveColor{Light: "1", Dark: "9"}
	ColorHint       = lipgloss.AdaptiveColor{Light: "245", Dark: "240"}
)
View Source
var (
	Stdin  io.Reader = os.Stdin
	Stdout io.Writer = os.Stdout
	Stderr io.Writer = os.Stderr
)

Functions

func AmbientSoundPath

func AmbientSoundPath() string

func ConfigFilePath

func ConfigFilePath() string

func DBFilePath

func DBFilePath() string

func Dir

func Dir() string

func SoundOpts

func SoundOpts() []string

func StatusFilePath

func StatusFilePath() string

Types

type CLIConfig

type CLIConfig struct {
	StartTime time.Time
	Tags      []string
}

arguments.

type CLIOptions

type CLIOptions struct {
	Since             string
	ShortBreak        string
	LongBreak         string
	Tags              string
	AmbientSound      string
	BreakSound        string
	WorkSound         string
	SessionCmd        string
	Work              string
	LongBreakInterval uint
	DisableNotify     bool
	SoundOnBreak      bool
	Strict            bool
}

CLIOptions represents command-line configuration options.

type Config

type Config struct {
	Style         Style
	CLI           CLIConfig
	Work          SessionConfig  `mapstructure:"work"`
	ShortBreak    SessionConfig  `mapstructure:"short_break"`
	LongBreak     SessionConfig  `mapstructure:"long_break"`
	Settings      SettingsConfig `mapstructure:"settings"`
	Display       DisplayConfig  `mapstructue:"display"`
	Notifications NotificationConfig
	// contains filtered or unexported fields
}

Config holds all configuration settings.

func New

func New(opts ...Option) (*Config, error)

New creates a new Config with default values and applies options.

func (*Config) Validate

func (c *Config) Validate() error

Validate performs validation checks on the Config struct and its fields.

type DisplayConfig

type DisplayConfig struct {
	DarkTheme bool `mapstructure:"dark_theme"`
}

DisplayConfig holds display-related settings.

type FilterConfig

type FilterConfig struct {
	StartTime time.Time
	EndTime   time.Time
	Tags      []string
}

FilterConfig represents a configuration to filter sessions in the database by their start time, end time, and assigned tags.

func Filter

func Filter(ctx *cli.Context) *FilterConfig

Filter initializes and returns a configuration to filter sessions from command-line arguments.

type NotificationConfig

type NotificationConfig struct {
	Enabled bool `mapstructure:"enabled"`
}

NotificationConfig holds notification settings.

type Option

type Option func(*Config) error

Option is a function that modifies Config.

func WithCLIConfig

func WithCLIConfig(ctx *cli.Context) Option

WithCLIConfig returns an Option that loads configuration from CLI flags.

func WithPromptConfig

func WithPromptConfig(configPath string) Option

WithPromptConfig returns an Option that configures settings via interactive prompts.

func WithViperConfig

func WithViperConfig(configPath string) Option

WithViperConfig returns an Option that loads configuration from Viper.

type PromptOptions

type PromptOptions struct {
	WorkDuration       int
	ShortBreakDuration int
	LongBreakDuration  int
	LongBreakInterval  int
}

PromptOptions holds the user's responses to the configuration prompts.

type SessionConfig

type SessionConfig struct {
	Message  string        `mapstructure:"message"`
	Sound    string        `mapstructure:"sound"`
	Duration time.Duration `mapstructure:"duration"`
}

type SessionType

type SessionType string

SessionType represents the type of timer session.

const (
	Work       SessionType = "Work session"
	ShortBreak SessionType = "Short break"
	LongBreak  SessionType = "Long break"
)

type SettingsConfig

type SettingsConfig struct {
	AmbientSound      string `mapstructure:"ambient_sound"`
	Cmd               string `mapstructure:"cmd"`
	LongBreakInterval int    `mapstructure:"long_break_interval"`
	AutoStartBreak    bool   `mapstructure:"auto_start_break"`
	AutoStartWork     bool   `mapstructure:"auto_start_work"`
	SoundOnBreak      bool   `mapstructure:"sound_on_break"`
	Strict            bool   `mapstructure:"strict"`
	TwentyFourHour    bool   `mapstructure:"24hr_clock"`
}

SettingsConfig contains general application settings.

type Style

type Style struct {
	Work       lipgloss.Style
	ShortBreak lipgloss.Style
	LongBreak  lipgloss.Style
	Base       lipgloss.Style
	Hint       lipgloss.Style
	Secondary  lipgloss.Style
	Main       lipgloss.Style
}

Jump to

Keyboard shortcuts

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