Add time undo and fill

This commit is contained in:
Martin Pander
2026-02-02 11:12:09 +01:00
parent fc8e9481c3
commit 9940316ace
5 changed files with 30 additions and 0 deletions

View File

@ -30,6 +30,7 @@ type TimeWarrior interface {
ContinueInterval(id int) error
CancelTracking() error
DeleteInterval(id int) error
FillInterval(id int) error
ModifyInterval(interval *Interval, adjust bool) error
GetSummary(filter ...string) string
GetActive() *Interval
@ -218,6 +219,19 @@ func (ts *TimeSquire) DeleteInterval(id int) error {
return nil
}
func (ts *TimeSquire) FillInterval(id int) error {
ts.mutex.Lock()
defer ts.mutex.Unlock()
cmd := exec.Command(twBinary, append(ts.defaultArgs, []string{"fill", fmt.Sprintf("@%d", id)}...)...)
if err := cmd.Run(); err != nil {
slog.Error("Failed filling interval:", err)
return err
}
return nil
}
func (ts *TimeSquire) ModifyInterval(interval *Interval, adjust bool) error {
ts.mutex.Lock()
defer ts.mutex.Unlock()