summaryrefslogtreecommitdiff
path: root/internal/askcli/command_add.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-05 10:26:16 +0300
committerPaul Buetow <paul@buetow.org>2026-06-05 10:26:16 +0300
commit1433f7a13ede0c819ec4f8fd4027ad3df8daa94f (patch)
treed3e98bc150711350585dd8203c5b50cc93243e52 /internal/askcli/command_add.go
parent0a52adf5752835da01e8a29df15e415398165c48 (diff)
Add 'ask edit' subcommand and collapse multi-line task descriptions
- ask edit opens $EDITOR and creates a task from the (multi-line) content, reusing the shared internal/editor package - collapse newlines in list output and fish completion so multi-line descriptions render on one line and don't break completion Bump version to 0.40.0 Amp-Thread-ID: https://ampcode.com/threads/T-019e96a1-9c8e-73d6-95b4-b55cb12cc762 Co-authored-by: Amp <amp@ampcode.com>
Diffstat (limited to 'internal/askcli/command_add.go')
-rw-r--r--internal/askcli/command_add.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/askcli/command_add.go b/internal/askcli/command_add.go
index 096046d..ccfb034 100644
--- a/internal/askcli/command_add.go
+++ b/internal/askcli/command_add.go
@@ -27,6 +27,12 @@ func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stder
writeInfoError(stderr, err)
return code, nil
}
+ return d.createTask(ctx, modifiers, description, dependencyUUIDs, stdout, stderr)
+}
+
+// createTask creates a Taskwarrior task from the given modifiers, description,
+// and resolved dependency UUIDs, assigns an alias, and prints the created task.
+func (d *Dispatcher) createTask(ctx context.Context, modifiers []string, description string, dependencyUUIDs []string, stdout, stderr io.Writer) (int, error) {
var outBuf bytes.Buffer
// rc.verbose=nothing keeps Taskwarrior quiet by default. rc.verbose=new-uuid
// then re-enables the UUID-only confirmation we parse below.
@@ -36,7 +42,7 @@ func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stder
taskArgs = append(taskArgs, "depends:"+strings.Join(dependencyUUIDs, ","))
}
taskArgs = append(taskArgs, description)
- code, err = d.runner.Run(ctx, taskArgs, nil, &outBuf, stderr)
+ code, err := d.runner.Run(ctx, taskArgs, nil, &outBuf, stderr)
if code != 0 {
return code, err
}