diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-23 07:41:07 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-23 07:41:07 +0200 |
| commit | 77a38b42f47e8842e5c60673f9b25e3871cf8d8e (patch) | |
| tree | e886cb0e4cd333c62f1fe9ab00661bacf719e611 /internal/askcli/taskexport.go | |
| parent | 987c08b9bd86f4e6afabfb3dcb0efaf98f1ccb38 (diff) | |
ask add: always emit UUID, never the numeric task ID
Use rc.verbose=new-uuid so taskwarrior prints "Created task <uuid>."
directly on stdout. Parse the UUID from that line instead of doing
a two-step numeric-ID lookup or falling back to an export call.
Removes ExtractUUIDFromOutput (which could leak numeric IDs) and
fetchUUIDByNumericID (the export fallback). Integration tests now
get the UUID straight from ask add output without any extra calls.
Also fixes TestMain_WiresDispatcher which expected "export" first
in args, but list now prepends status:pending filter.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/askcli/taskexport.go')
| -rw-r--r-- | internal/askcli/taskexport.go | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/internal/askcli/taskexport.go b/internal/askcli/taskexport.go index c18cd4e..9841821 100644 --- a/internal/askcli/taskexport.go +++ b/internal/askcli/taskexport.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "strings" ) type TaskExport struct { @@ -41,36 +40,3 @@ func MustParseTaskExport(data []byte) []TaskExport { } return tasks } - -func ExtractUUIDFromOutput(output string) string { - lines := strings.Split(strings.TrimSpace(output), "\n") - for _, line := range lines { - if strings.HasPrefix(line, "UUID:") { - parts := strings.Fields(line) - if len(parts) >= 2 { - return parts[1] - } - } - } - for _, line := range lines { - if strings.HasPrefix(line, "Created task ") { - parts := strings.Fields(line) - if len(parts) >= 3 { - return strings.TrimSuffix(parts[2], ".") - } - } - } - fields := strings.Fields(output) - for i, f := range fields { - if f == "uuid" && i+1 < len(fields) { - return fields[i+1] - } - if strings.HasPrefix(f, "Created task") { - parts := strings.Split(f, " ") - if len(parts) >= 2 { - return strings.TrimSuffix(parts[1], ".") - } - } - } - return strings.TrimSpace(output) -} |
