config

package
v1.0.3-0...-7e9eecf Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTheme is the default color scheme
	DefaultTheme = Theme{
		Name:           "default",
		TimerColor:     "\033[1;32m",
		ProgressColor:  "\033[1;34m",
		SuccessColor:   "\033[1;32m",
		WarningColor:   "\033[1;33m",
		TextColor:      "\033[0m",
		HighlightColor: "\033[1;36m",
	}

	// MinimalTheme is a minimal color scheme
	MinimalTheme = Theme{
		Name:           "minimal",
		TimerColor:     "\033[0m",
		ProgressColor:  "\033[0m",
		SuccessColor:   "\033[0m",
		WarningColor:   "\033[0m",
		TextColor:      "\033[0m",
		HighlightColor: "\033[1m",
	}

	// VibrantTheme is a colorful theme
	VibrantTheme = Theme{
		Name:           "vibrant",
		TimerColor:     "\033[1;35m",
		ProgressColor:  "\033[1;36m",
		SuccessColor:   "\033[1;32m",
		WarningColor:   "\033[1;31m",
		TextColor:      "\033[1;37m",
		HighlightColor: "\033[1;33m",
	}

	// Available themes
	AvailableThemes = map[string]Theme{
		"default": DefaultTheme,
		"minimal": MinimalTheme,
		"vibrant": VibrantTheme,
	}
)
View Source
var DefaultConfig = Config{
	WorkMinutes:    25,
	BreakMinutes:   5,
	NumSessions:    4,
	CurrentProfile: "default",
	PrivacyMode:    false,
	CloudSync:      false,
	CloudProvider:  "",
}
View Source
var DefaultProfiles = []Profile{
	{Name: "default", WorkMinutes: 25, BreakMinutes: 5, NumSessions: 4, Description: "Standard Pomodoro"},
	{Name: "work", WorkMinutes: 45, BreakMinutes: 10, NumSessions: 3, Description: "Deep work sessions"},
	{Name: "study", WorkMinutes: 30, BreakMinutes: 5, NumSessions: 4, Description: "Study sessions"},
	{Name: "quick", WorkMinutes: 15, BreakMinutes: 3, NumSessions: 6, Description: "Quick tasks"},
}

Functions

func AddPlugin

func AddPlugin(plugin Plugin) error

func AddProfile

func AddProfile(profile Profile) error

func AddTask

func AddTask(title, description string, tags []string) error

AddTask adds a new task to the list

func CompleteTask

func CompleteTask(id string) error

CompleteTask marks a task as completed

func EnablePlugin

func EnablePlugin(name string, enabled bool) error

func ExecutePlugins

func ExecutePlugins(trigger string, sessionData map[string]string) error

func ExportToCSV

func ExportToCSV(filepath string) error

func ExportToJSON

func ExportToJSON(filepath string) error

func GenerateCalendarView

func GenerateCalendarView(months int) (string, error)

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir returns the path to the configuration directory

func GetGoalFilePath

func GetGoalFilePath() (string, error)

GetGoalFilePath returns the path to the goals configuration file

func GetPluginPath

func GetPluginPath() (string, error)

func GetProfilePath

func GetProfilePath() (string, error)

Profile management functions

func GetTaskFilePath

func GetTaskFilePath() (string, error)

GetTaskFilePath returns the path to the tasks file

func GetThemeFilePath

func GetThemeFilePath() (string, error)

GetThemeFilePath returns the path to the theme configuration file

func GetTodayStats

func GetTodayStats() (int, int, error)

func ImportFromJSON

func ImportFromJSON(filepath string) error

func ListTasks

func ListTasks(showCompleted bool) error

ListTasks displays all tasks

func ListThemes

func ListThemes()

ListThemes prints all available themes

func SaveConfig

func SaveConfig(config Config) error

SaveConfig saves the configuration to the config file

func SaveGoal

func SaveGoal(goal Goal) error

SaveGoal saves the current goal to the configuration file

func SavePlugins

func SavePlugins(plugins PluginConfig) error

func SaveProfiles

func SaveProfiles(profiles ProfileConfig) error

func SaveProgress

func SaveProgress(progress GoalProgress) error

SaveProgress saves the current progress to the configuration file

func SaveTasks

func SaveTasks(tasks TaskList) error

SaveTasks saves the task list to the configuration file

func SaveTheme

func SaveTheme(theme Theme) error

SaveTheme saves the current theme to the configuration file

func ShowProgress

func ShowProgress() error

ShowProgress displays the current progress towards goals

func SyncData

func SyncData(upload bool) error

func UpdateProgress

func UpdateProgress(sessions, minutes int) error

UpdateProgress updates the goal progress for today

func UpdateTaskProgress

func UpdateTaskProgress(id string, sessions, minutes int) error

UpdateTaskProgress updates the time spent on a task

Types

type CalendarDay

type CalendarDay struct {
	Date     time.Time
	Sessions int
	Minutes  int
	Level    int // 0-4 intensity level for heatmap
}

type Config

type Config struct {
	WorkMinutes    int    `json:"work_minutes"`
	BreakMinutes   int    `json:"break_minutes"`
	NumSessions    int    `json:"num_sessions"`
	CurrentProfile string `json:"current_profile"`
	PrivacyMode    bool   `json:"privacy_mode"`
	CloudSync      bool   `json:"cloud_sync"`
	CloudProvider  string `json:"cloud_provider"`
}

func LoadConfig

func LoadConfig() (Config, error)

LoadConfig loads the configuration from the config file

type DropboxSync

type DropboxSync struct {
	AccessToken string
}

func (*DropboxSync) Download

func (d *DropboxSync) Download(remotePath, localPath string) error

func (*DropboxSync) IsAvailable

func (d *DropboxSync) IsAvailable() bool

func (*DropboxSync) Upload

func (d *DropboxSync) Upload(localPath, remotePath string) error

type ExportData

type ExportData struct {
	Sessions []SessionData `json:"sessions"`
	Tasks    []Task        `json:"tasks"`
	Goal     Goal          `json:"goal"`
	Progress GoalProgress  `json:"progress"`
	Config   Config        `json:"config"`
	Profiles []Profile     `json:"profiles"`
}

type GitHubSync

type GitHubSync struct {
	RepoURL string
	Token   string
}

func (*GitHubSync) Download

func (g *GitHubSync) Download(remotePath, localPath string) error

func (*GitHubSync) IsAvailable

func (g *GitHubSync) IsAvailable() bool

func (*GitHubSync) Upload

func (g *GitHubSync) Upload(localPath, remotePath string) error

type Goal

type Goal struct {
	DailySessionTarget int       `json:"daily_session_target"` // Target number of sessions per day
	DailyMinutes       int       `json:"daily_minutes"`        // Target minutes of focus time per day
	StartDate          time.Time `json:"start_date"`           // When this goal was set
	EndDate            time.Time `json:"end_date,omitempty"`   // Optional end date for the goal
}

Goal represents a daily Pomodoro goal

func LoadGoal

func LoadGoal() (Goal, error)

LoadGoal loads the goal from the configuration file

type GoalProgress

type GoalProgress struct {
	CurrentDate    time.Time `json:"current_date"`
	SessionsToday  int       `json:"sessions_today"`
	MinutesToday   int       `json:"minutes_today"`
	CurrentStreak  int       `json:"current_streak"`   // Days in a row meeting goals
	LongestStreak  int       `json:"longest_streak"`   // Longest streak ever
	LastUpdateDate time.Time `json:"last_update_date"` // Last time progress was updated
}

GoalProgress tracks progress towards goals

func LoadProgress

func LoadProgress() (GoalProgress, error)

LoadProgress loads the progress from the configuration file

type Plugin

type Plugin struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Script      string   `json:"script"`
	Triggers    []string `json:"triggers"` // "session_start", "session_end", "break_start", "break_end"
	Enabled     bool     `json:"enabled"`
	Args        []string `json:"args"`
}

type PluginConfig

type PluginConfig struct {
	Plugins []Plugin `json:"plugins"`
}

func LoadPlugins

func LoadPlugins() (PluginConfig, error)

type Profile

type Profile struct {
	Name         string `json:"name"`
	WorkMinutes  int    `json:"work_minutes"`
	BreakMinutes int    `json:"break_minutes"`
	NumSessions  int    `json:"num_sessions"`
	Description  string `json:"description"`
}

func GetProfile

func GetProfile(name string) (Profile, error)

type ProfileConfig

type ProfileConfig struct {
	Profiles []Profile `json:"profiles"`
}

func LoadProfiles

func LoadProfiles() (ProfileConfig, error)

type SessionData

type SessionData struct {
	Date         time.Time `json:"date"`
	WorkMinutes  int       `json:"work_minutes"`
	BreakMinutes int       `json:"break_minutes"`
	Sessions     int       `json:"sessions"`
	Completed    bool      `json:"completed"`
	Profile      string    `json:"profile"`
}

type SessionStats

type SessionStats struct {
	AverageWorkTime    float64
	AverageBreakTime   float64
	CompletionRate     float64
	PreferredTimeSlots []int // Hours of day
	ProductivityScore  float64
}

func AnalyzePerformance

func AnalyzePerformance() (SessionStats, error)

type Suggestion

type Suggestion struct {
	Type       string  `json:"type"`
	Message    string  `json:"message"`
	WorkTime   int     `json:"work_time,omitempty"`
	BreakTime  int     `json:"break_time,omitempty"`
	Sessions   int     `json:"sessions,omitempty"`
	Confidence float64 `json:"confidence"`
}

func GenerateSuggestions

func GenerateSuggestions() ([]Suggestion, error)

type SyncProvider

type SyncProvider interface {
	Upload(localPath, remotePath string) error
	Download(remotePath, localPath string) error
	IsAvailable() bool
}

func GetSyncProvider

func GetSyncProvider(config Config) SyncProvider

type Task

type Task struct {
	ID          string    `json:"id"`           // Unique identifier
	Title       string    `json:"title"`        // Task title
	Description string    `json:"description"`  // Optional description
	CreatedAt   time.Time `json:"created_at"`   // When the task was created
	CompletedAt time.Time `json:"completed_at"` // When the task was completed
	Sessions    int       `json:"sessions"`     // Number of sessions spent on this task
	Minutes     int       `json:"minutes"`      // Total minutes spent on this task
	Tags        []string  `json:"tags"`         // Optional tags for categorization
	IsCompleted bool      `json:"is_completed"` // Whether the task is completed
}

Task represents a task to be completed during Pomodoro sessions

type TaskList

type TaskList struct {
	Tasks []Task `json:"tasks"`
}

TaskList represents a list of tasks

func LoadTasks

func LoadTasks() (TaskList, error)

LoadTasks loads the task list from the configuration file

type Theme

type Theme struct {
	Name            string `json:"name"`
	TimerColor      string `json:"timer_color"`      // Color for timer display
	ProgressColor   string `json:"progress_color"`   // Color for progress bar
	SuccessColor    string `json:"success_color"`    // Color for success messages
	WarningColor    string `json:"warning_color"`    // Color for warning messages
	TextColor       string `json:"text_color"`       // Color for regular text
	HighlightColor  string `json:"highlight_color"`  // Color for highlighted text
	BackgroundColor string `json:"background_color"` // Color for background (if supported)
}

Theme represents a color scheme for the application

func LoadTheme

func LoadTheme() (Theme, error)

LoadTheme loads the theme from the configuration file

Jump to

Keyboard shortcuts

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