[WIP] Add task editing
This commit is contained in:
@ -87,6 +87,7 @@ type TaskWarrior interface {
|
||||
|
||||
GetTasks(report *Report, filter ...string) Tasks
|
||||
AddTask(task *Task) error
|
||||
ModifyTask(task *Task)
|
||||
}
|
||||
|
||||
type TaskSquire struct {
|
||||
@ -323,6 +324,24 @@ func (ts *TaskSquire) AddTask(task *Task) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// TODO error handling
|
||||
func (ts *TaskSquire) ModifyTask(task *Task) {
|
||||
ts.mutex.Lock()
|
||||
defer ts.mutex.Unlock()
|
||||
|
||||
jsonStr, err := json.Marshal(Tasks{task})
|
||||
if err != nil {
|
||||
slog.Error("Failed marshalling task:", err)
|
||||
}
|
||||
|
||||
cmd := exec.Command(twBinary, append([]string{"echo", string(jsonStr), "|"}, append(ts.defaultArgs, []string{"import", "-"}...)...)...)
|
||||
out, err := cmd.CombinedOutput()
|
||||
strOut := string(out)
|
||||
if err != nil {
|
||||
slog.Error("Failed modifying task:", err, strOut)
|
||||
}
|
||||
}
|
||||
|
||||
func (ts *TaskSquire) extractConfig() *TWConfig {
|
||||
cmd := exec.Command(twBinary, append(ts.defaultArgs, []string{"_show"}...)...)
|
||||
output, err := cmd.CombinedOutput()
|
||||
|
||||
Reference in New Issue
Block a user