history

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportCmd

func ExportCmd() *cobra.Command

func LogCmd

func LogCmd() *cobra.Command

func ShowAllTimeStats

func ShowAllTimeStats(entries []*storage.TimeEntry, db *storage.Database)

ShowAllTimeStats prints aggregated all-time statistics to standard output. Given a slice of *storage.TimeEntry and a pointer to the database, the function:

  • returns early with a message if entries is empty,
  • computes and prints the total accumulated time and its hour equivalent,
  • prints the total number of entries and number of tracked projects,
  • aggregates time by project and prints a per-project line with duration and percentage of the total.

The function fetches the list of projects from the provided database to determine the number of projects tracked. Aggregation is done via a map[string]time.Duration; iteration order is therefore non-deterministic. If the total duration is zero, percentage values may be undefined. All output is produced using fmt.

func ShowPeriodStats

func ShowPeriodStats(entries []*storage.TimeEntry, periodName string)

ShowPeriodStats prints aggregated statistics for a named period to standard output. Given a slice of *storage.TimeEntry and a human-readable periodName, the function:

  • returns early with a message if entries is empty,
  • computes and prints the total accumulated time and its hour equivalent,
  • prints the total number of entries,
  • aggregates time by project and prints a per-project line with duration and percentage of the total,
  • attempts to load configuration and, if a positive hourly rate is present, prints an estimated earnings line.

Aggregation is done via a map[string]time.Duration; iteration order is therefore non-deterministic. Percentages are computed as projectSeconds / totalSeconds * 100, so if the total duration is zero the percentage values may be undefined (NaN/Inf). All output is produced using fmt.

func StatsCmd

func StatsCmd() *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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