Skip to content

Commit 6fffeef

Browse files
committed
(wip)
1 parent eb79f40 commit 6fffeef

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package util
2+
3+
import (
4+
"github.com/lucassabreu/clockify-cli/pkg/cmd/time-entry/util/defaults"
5+
"github.com/lucassabreu/clockify-cli/pkg/cmdutil"
6+
)
7+
8+
// FromDefaults starts a TimeEntryDTO with the current defaults
9+
func FromDefaults(f cmdutil.Factory) Step {
10+
return func(ted TimeEntryDTO) (TimeEntryDTO, error) {
11+
d, err := f.TimeEntryDefaults().Read()
12+
if err != nil && err != defaults.DefaultsFileNotFoundErr {
13+
return ted, err
14+
}
15+
16+
ted.ProjectID = d.ProjectID
17+
ted.TaskID = d.TaskID
18+
ted.TagIDs = d.TagIDs
19+
ted.Billable = d.Billable
20+
21+
return ted, nil
22+
}
23+
}

0 commit comments

Comments
 (0)