Add timestamp editor

This commit is contained in:
Martin Pander
2026-02-02 10:55:47 +01:00
parent 7032d0fa54
commit fc8e9481c3
19 changed files with 922 additions and 113 deletions

View File

@ -30,7 +30,7 @@ type TimeWarrior interface {
ContinueInterval(id int) error
CancelTracking() error
DeleteInterval(id int) error
ModifyInterval(interval *Interval) error
ModifyInterval(interval *Interval, adjust bool) error
GetSummary(filter ...string) string
GetActive() *Interval
@ -218,7 +218,7 @@ func (ts *TimeSquire) DeleteInterval(id int) error {
return nil
}
func (ts *TimeSquire) ModifyInterval(interval *Interval) error {
func (ts *TimeSquire) ModifyInterval(interval *Interval, adjust bool) error {
ts.mutex.Lock()
defer ts.mutex.Unlock()
@ -229,8 +229,14 @@ func (ts *TimeSquire) ModifyInterval(interval *Interval) error {
return err
}
// Build import command with optional :adjust hint
args := append(ts.defaultArgs, "import")
if adjust {
args = append(args, ":adjust")
}
// Import the modified interval
cmd := exec.Command(twBinary, append(ts.defaultArgs, []string{"import"}...)...)
cmd := exec.Command(twBinary, args...)
cmd.Stdin = bytes.NewBuffer(intervals)
out, err := cmd.CombinedOutput()
if err != nil {