We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eb79f40 commit 6fffeefCopy full SHA for 6fffeef
pkg/cmd/time-entry/util/from-defaults.go
@@ -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