Documentation
¶
Index ¶
- Constants
- func CleanupStaleSession(session Session, logAsAbandoned bool) error
- func DeleteLogEntry(entryToDelete LogEntry) error
- func FormatDuration(d time.Duration) string
- func GetConfigPath() (string, error)
- func GetLogDir() (string, error)
- func GetLogPath(date time.Time) (string, error)
- func GetSessionPath() (string, error)
- func HandleDashboard()
- func HandleExport()
- func HandleLog(showStats, filterToday, filterWeek, filterMonth, showAll bool, monthStr string)
- func IsSessionStale(session Session, threshold time.Duration) bool
- func LogSession(entry LogEntry) error
- func RunHook(event string, args ...string)
- func SaveSession(session Session) error
- func SessionExists() bool
- func ShowVersion(version, commit, date string)
- type ActivityStat
- type Config
- type LogEntry
- type LogReader
- type LogStats
- type Session
Constants ¶
const ( Reset = "\033[0m" Bold = "\033[1m" Dim = "\033[2m" Gray = "\033[90m" // High-contrast, 5-tier blue color scale for the dashboard // Using 256-color ANSI codes for better terminal compatibility. Color0 = "\033[38;5;250m" // Light Gray (for empty days) Blue1 = "\033[38;5;117m" // Lightest Blue Blue2 = "\033[38;5;75m" // Light Blue Blue3 = "\033[38;5;33m" // Medium Blue Blue4 = "\033[38;5;21m" // Darkest Blue )
ANSI color codes for calm, minimal output
Variables ¶
This section is empty.
Functions ¶
func CleanupStaleSession ¶ added in v1.1.6
CleanupStaleSession removes a stale session file and optionally logs it as abandoned
func DeleteLogEntry ¶ added in v1.1.5
DeleteLogEntry removes a specific log entry from the log files.
func FormatDuration ¶
func GetConfigPath ¶ added in v1.1.3
GetConfigPath determines the expected path for the configuration file.
func GetLogPath ¶
GetLogPath returns the path to the session log file for a specific month
func HandleDashboard ¶
func HandleDashboard()
func HandleExport ¶
func HandleExport()
func IsSessionStale ¶ added in v1.1.6
IsSessionStale checks if a session has been running for an unreasonable amount of time
func LogSession ¶
LogSession appends a completed session to the appropriate monthly log file
func SaveSession ¶
func SessionExists ¶
func SessionExists() bool
func ShowVersion ¶
func ShowVersion(version, commit, date string)
Types ¶
type ActivityStat ¶
ActivityStat represents statistics for a specific activity
type Config ¶ added in v1.1.2
type Config struct {
StaleSessionThreshold string `yaml:"stale_session_threshold"`
// contains filtered or unexported fields
}
Config holds all application configuration.
func LoadConfig ¶ added in v1.1.2
LoadConfig loads the configuration from the YAML file, applying defaults.
func (*Config) ParsedStaleSessionThreshold ¶ added in v1.1.6
ParsedStaleSessionThreshold returns the parsed stale session threshold duration.
type LogEntry ¶
type LogEntry struct {
Tag string `json:"tag"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Duration time.Duration `json:"duration"`
TotalPaused time.Duration `json:"total_paused,omitempty"`
}
LogEntry represents a completed session for logging
func GetRecentSessions ¶ added in v1.1.5
GetRecentSessions retrieves the most recent log entries.
type LogReader ¶
type LogReader struct {
// contains filtered or unexported fields
}
LogReader provides efficient reading of log entries from partitioned files
func (*LogReader) ReadAllEntries ¶
ReadAllEntries reads all entries (use with caution for large datasets)
func (*LogReader) ReadMonthEntries ¶
ReadMonthEntries reads entries from a specific month
type LogStats ¶
type LogStats struct {
TotalTime time.Duration
TotalSessions int
AverageTime time.Duration
TopActivities []ActivityStat
DateRange string
}
LogStats contains aggregated statistics
func CalculateStats ¶
CalculateStats computes statistics from log entries
type Session ¶
type Session struct {
Tag string `json:"tag"`
StartTime time.Time `json:"start_time"`
TargetDuration time.Duration `json:"target_duration,omitempty"`
PausedAt time.Time `json:"paused_at,omitempty"`
IsPaused bool `json:"is_paused"`
TotalPaused time.Duration `json:"total_paused"`
}
Session represents a Flow work session