Documentation
¶
Overview ¶
Package config handles loading and validating sked configurations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindOrCreateDefault ¶
FindOrCreateDefault finds the default config file, creating it if it doesn't exist. It returns the path to the config file.
Types ¶
type Config ¶
type Config struct {
CycleDays int `toml:"cycle_days"`
AnchorDate string `toml:"anchor_date"`
CSVPath string `toml:"csv_path"`
TmpCSVPath string `toml:"tmp_csv_path"`
DateFormat string `toml:"date_format"`
Days []Day `toml:"day"`
Overrides []Override `toml:"override"`
SkipWeekends bool `toml:"skip_weekends"`
Saturday []Task `toml:"saturday"`
Sunday []Task `toml:"sunday"`
}
Config represents the top-level configuration structure.
func Load ¶
Load reads the configuration from the specified path. It detects the format based on the file extension (.toml or .csv).
func LoadCSV ¶
LoadCSV reads a CSV configuration file. CSV format assumes a standard 7-day cycle. Header: Start,End,Mon,Tue,Wed,Thu,Fri,Sat,Sun (flexible day column order)
func LoadTmpCSV ¶
LoadTmpCSV reads a temporary CSV configuration file. It expects "Start", "End", and "Task" columns. Tasks are assigned to the current day (as of when this function is called).
func (*Config) ProcessOverrides ¶
ProcessOverrides parses raw override data into usable structs.
type DayID ¶ added in v0.1.4
type DayID int
DayID is Used for flexible config for either number-based or word-based day of week
func (*DayID) UnmarshalTOML ¶ added in v0.1.4
func (*DayID) UnmarshalText ¶ added in v0.1.4
type Override ¶
type Override struct {
DateStr string `toml:"date"`
EndDateStr string `toml:"end_date"`
IsOff bool `toml:"is_off"`
UseDayID DayID `toml:"use_day_id"`
// Internal fields populated during validation
Date time.Time `toml:"-"`
EndDate time.Time `toml:"-"`
}
Override represents a temporary schedule change for a specific date.