Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

func ConfigCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "config",
Use: "config",
Aliases: []string{"settings", "preferences"},
Short: "Configure global tmpo settings",
Long: `Set up global configuration for tmpo including currency, date/time format, and timezone.`,
Short: "Configure global tmpo settings",
Long: `Set up global configuration for tmpo including currency, date/time format, and timezone.`,
Run: func(cmd *cobra.Command, args []string) {
ui.NewlineAbove()

Expand Down
2 changes: 1 addition & 1 deletion cmd/entries/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"os"

"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/DylanDevelops/tmpo/internal/project"
"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/DylanDevelops/tmpo/internal/storage"
"github.com/DylanDevelops/tmpo/internal/ui"
"github.com/manifoldco/promptui"
Expand Down
9 changes: 4 additions & 5 deletions cmd/entries/manual.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ManualCmd() *cobra.Command {
}

projectPrompt := promptui.Prompt{
Label: projectLabel,
Label: projectLabel,
AllowEdit: true,
}

Expand Down Expand Up @@ -290,7 +290,6 @@ func validateTime(input string) error {
return fmt.Errorf("invalid time format, use 12-hour (e.g., 9:30 AM) or 24-hour (e.g., 14:30)")
}


func validateEndDateTime(startDate, startTime, endDate, endTime, dateLayout string) error {
start, err := parseDateTime(startDate, startTime, dateLayout)
if err != nil {
Expand All @@ -313,15 +312,15 @@ func parseDateTime(date, timeStr, dateLayout string) (time.Time, error) {
normalizedTime := normalizeAMPM(timeStr)
dateTime := fmt.Sprintf("%s %s", date, normalizedTime)

if dt, err := time.ParseInLocation(dateLayout + " 3:04 PM", dateTime, settings.GetDisplayTimezone()); err == nil {
if dt, err := time.ParseInLocation(dateLayout+" 3:04 PM", dateTime, settings.GetDisplayTimezone()); err == nil {
return dt, nil
}

if dt, err := time.ParseInLocation(dateLayout + " 03:04 PM", dateTime, settings.GetDisplayTimezone()); err == nil {
if dt, err := time.ParseInLocation(dateLayout+" 03:04 PM", dateTime, settings.GetDisplayTimezone()); err == nil {
return dt, nil
}

return time.ParseInLocation(dateLayout + " 15:04", dateTime, settings.GetDisplayTimezone())
return time.ParseInLocation(dateLayout+" 15:04", dateTime, settings.GetDisplayTimezone())
}

func normalizeAMPM(input string) string {
Expand Down
4 changes: 2 additions & 2 deletions cmd/history/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import (
"sort"
"time"

"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/DylanDevelops/tmpo/internal/currency"
"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/DylanDevelops/tmpo/internal/storage"
"github.com/DylanDevelops/tmpo/internal/ui"
"github.com/spf13/cobra"
)

var (
statsToday bool
statsWeek bool
statsWeek bool
)

func StatsCmd() *cobra.Command {
Expand Down
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ Track time effortlessly with automatic project detection and simple commands.`,
cmd.AddCommand(tracking.PauseCmd())
cmd.AddCommand(tracking.ResumeCmd())
cmd.AddCommand(tracking.StatusCmd())

// History
cmd.AddCommand(history.LogCmd())
cmd.AddCommand(history.StatsCmd())
cmd.AddCommand(history.ExportCmd())

// Entries
cmd.AddCommand(entries.EditCmd())
cmd.AddCommand(entries.DeleteCmd())
Expand Down
2 changes: 1 addition & 1 deletion cmd/tracking/pause.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func PauseCmd() *cobra.Command {
}

err = db.StopEntry(running.ID)
if(err != nil) {
if err != nil {
ui.PrintError(ui.EmojiError, fmt.Sprintf("%v", err))
os.Exit(1)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/tracking/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"path/filepath"
"testing"

"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/DylanDevelops/tmpo/internal/project"
"github.com/DylanDevelops/tmpo/internal/settings"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/tracking/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func StatusCmd() *cobra.Command {
}

if running.MilestoneName != nil && *running.MilestoneName != "" {
ui.PrintInfo(4, ui.Bold("Milestone"), *running.MilestoneName);
ui.PrintInfo(4, ui.Bold("Milestone"), *running.MilestoneName)
}

ui.NewlineBelow()
Expand Down
2 changes: 1 addition & 1 deletion cmd/tracking/stop.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func StopCmd() *cobra.Command {
}

err = db.StopEntry(running.ID)
if(err != nil) {
if err != nil {
ui.PrintError(ui.EmojiError, fmt.Sprintf("%v", err))
os.Exit(1)
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/utilities/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ var releaseVersionRegex = regexp.MustCompile(`^v?\d+\.\d+\.\d+(-[\w.]+)?$`)

func VersionCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Show version information",
Long: "Display the current version information including date and release URL.",
Use: "version",
Short: "Show version information",
Long: "Display the current version information including date and release URL.",
Hidden: true,
Run: func(cmd *cobra.Command, args []string) {
DisplayVersionWithUpdateCheck()
Expand Down
16 changes: 8 additions & 8 deletions internal/currency/currency.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ var currencySymbols = map[string]string{
"ARS": "AR$", // Argentine Peso

// Europe
"EUR": "€", // Euro
"GBP": "£", // British Pound Sterling
"CHF": "Fr", // Swiss Franc
"SEK": "kr", // Swedish Krona
"NOK": "kr", // Norwegian Krone
"DKK": "kr", // Danish Krone
"PLN": "zł", // Polish Zloty
"CZK": "Kč", // Czech Koruna
"EUR": "€", // Euro
"GBP": "£", // British Pound Sterling
"CHF": "Fr", // Swiss Franc
"SEK": "kr", // Swedish Krona
"NOK": "kr", // Norwegian Krone
"DKK": "kr", // Danish Krone
"PLN": "zł", // Polish Zloty
"CZK": "Kč", // Czech Koruna

// Asia
"JPY": "¥", // Japanese Yen
Expand Down
2 changes: 1 addition & 1 deletion internal/export/csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ func ToCSV(entries []*storage.TimeEntry, filename string) error {
}

return nil
}
}
2 changes: 1 addition & 1 deletion internal/export/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ func ToJson(entries []*storage.TimeEntry, filename string) error {
}

return nil
}
}
1 change: 0 additions & 1 deletion internal/project/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func DetectProject() (string, error) {
return filepath.Base(cwd), nil
}


func DetectConfiguredProject() (string, error) {
return DetectConfiguredProjectWithOverride("")
}
Expand Down
10 changes: 5 additions & 5 deletions internal/settings/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (

// IMPORTANT: When adding new fields to this struct, also update configTemplate below.
type Config struct {
ProjectName string `yaml:"project_name"`
HourlyRate float64 `yaml:"hourly_rate,omitempty"`
Description string `yaml:"description,omitempty"`
ExportPath string `yaml:"export_path,omitempty"`
ProjectName string `yaml:"project_name"`
HourlyRate float64 `yaml:"hourly_rate,omitempty"`
Description string `yaml:"description,omitempty"`
ExportPath string `yaml:"export_path,omitempty"`
}

// IMPORTANT: When adding new fields to Config, update this template.
Expand Down Expand Up @@ -63,7 +63,7 @@ func (c *Config) Save(path string) error {
func Create(projectName string, hourlyRate float64) error {
config := &Config{
ProjectName: projectName,
HourlyRate: hourlyRate,
HourlyRate: hourlyRate,
}

tmporc := filepath.Join(".", ".tmporc")
Expand Down
2 changes: 1 addition & 1 deletion internal/storage/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (d *Database) StopEntry(id int64) error {
id,
)

if(err != nil) {
if err != nil {
return fmt.Errorf("failed to stop entry: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion internal/storage/migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestMigrateTimestampsToUTC_LocalToUTC(t *testing.T) {
assert.NoError(t, err)

localTime := time.Date(2026, 1, 8, 15, 30, 0, 0, est) // 3:30 PM EST
expectedUTC := localTime.UTC() // Should convert to 8:30 PM UTC
expectedUTC := localTime.UTC() // Should convert to 8:30 PM UTC

// Insert time entry with local timezone
_, err = db.db.Exec(
Expand Down
16 changes: 8 additions & 8 deletions internal/storage/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import (
)

type TimeEntry struct {
ID int64
ProjectName string
StartTime time.Time
EndTime *time.Time
Description string
HourlyRate *float64
ID int64
ProjectName string
StartTime time.Time
EndTime *time.Time
Description string
HourlyRate *float64
MilestoneName *string
}

func (t *TimeEntry) Duration() time.Duration {
if( t.EndTime == nil) {
if t.EndTime == nil {
return time.Since(t.StartTime)
}

Expand Down Expand Up @@ -50,4 +50,4 @@ func (m *Milestone) Duration() time.Duration {
return time.Since(m.StartTime)
}
return m.EndTime.Sub(m.StartTime)
}
}
6 changes: 3 additions & 3 deletions internal/ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const (
FormatUnderline = "\033[4m"

// Specific reset codes (don't reset colors)
ResetBoldDim = "\033[22m" // Reset bold and dim
ResetItalic = "\033[23m" // Reset italic
ResetUnderline = "\033[24m" // Reset underline
ResetBoldDim = "\033[22m" // Reset bold and dim
ResetItalic = "\033[23m" // Reset italic
ResetUnderline = "\033[24m" // Reset underline
)

// Emoji Constants
Expand Down
6 changes: 3 additions & 3 deletions internal/update/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
)

const (
githubAPIURL = "https://api.github.com/repos/DylanDevelops/tmpo/releases/latest"
checkTimeout = 3 * time.Second
connectTimeout = 2 * time.Second
githubAPIURL = "https://api.github.com/repos/DylanDevelops/tmpo/releases/latest"
checkTimeout = 3 * time.Second
connectTimeout = 2 * time.Second
)

type ReleaseInfo struct {
Expand Down