Skip to content

Commit

Permalink
(wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucassabreu committed Jul 23, 2024
1 parent eb79f40 commit 6fffeef
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pkg/cmd/time-entry/util/from-defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package util

import (
"github.com/lucassabreu/clockify-cli/pkg/cmd/time-entry/util/defaults"
"github.com/lucassabreu/clockify-cli/pkg/cmdutil"
)

// FromDefaults starts a TimeEntryDTO with the current defaults
func FromDefaults(f cmdutil.Factory) Step {
return func(ted TimeEntryDTO) (TimeEntryDTO, error) {
d, err := f.TimeEntryDefaults().Read()
if err != nil && err != defaults.DefaultsFileNotFoundErr {
return ted, err
}

ted.ProjectID = d.ProjectID
ted.TaskID = d.TaskID
ted.TagIDs = d.TagIDs
ted.Billable = d.Billable

return ted, nil
}
}

0 comments on commit 6fffeef

Please sign in to comment.