Add timestamp editor
This commit is contained in:
@ -144,7 +144,7 @@ func formatDate(date string, format string) string {
|
||||
slog.Error("Failed to parse time:", err)
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
dt = dt.Local()
|
||||
|
||||
switch format {
|
||||
|
||||
@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user