diff options
| author | Paul Buetow <paul@buetow.org> | 2026-03-27 11:31:15 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-03-27 11:31:15 +0200 |
| commit | 56e9f980e52a53197ace71acdb277ba0e0368916 (patch) | |
| tree | e608e2ad400087278a8821559d15536e3e0407dd /internal | |
| parent | 60ad41f9b49b3e93bc513e0035323d1ed9e81faf (diff) | |
Explicitly ignore askcli write errors
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/askcli/command_add.go | 8 | ||||
| -rw-r--r-- | internal/askcli/command_delete.go | 4 | ||||
| -rw-r--r-- | internal/askcli/command_delete_test.go | 6 | ||||
| -rw-r--r-- | internal/askcli/command_dep.go | 14 | ||||
| -rw-r--r-- | internal/askcli/command_dep_test.go | 18 | ||||
| -rw-r--r-- | internal/askcli/command_info.go | 8 | ||||
| -rw-r--r-- | internal/askcli/command_info_add_test.go | 30 | ||||
| -rw-r--r-- | internal/askcli/command_list_test.go | 12 | ||||
| -rw-r--r-- | internal/askcli/command_urgency_test.go | 6 | ||||
| -rw-r--r-- | internal/askcli/command_write.go | 18 | ||||
| -rw-r--r-- | internal/askcli/command_write_test.go | 24 | ||||
| -rw-r--r-- | internal/askcli/dispatch.go | 42 | ||||
| -rw-r--r-- | internal/askcli/formatter.go | 4 | ||||
| -rw-r--r-- | internal/askcli/render_task_list.go | 6 | ||||
| -rw-r--r-- | internal/askcli/task_selector_test.go | 2 |
15 files changed, 101 insertions, 101 deletions
diff --git a/internal/askcli/command_add.go b/internal/askcli/command_add.go index cda0637..c28650e 100644 --- a/internal/askcli/command_add.go +++ b/internal/askcli/command_add.go @@ -10,7 +10,7 @@ import ( func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask add requires a description\n") + _, _ = io.WriteString(stderr, "error: ask add requires a description\n") return 1, nil } modifiers, description, dependencySelectors, err := parseAddArgs(args[1:]) @@ -19,7 +19,7 @@ func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stder return 1, nil } if strings.TrimSpace(description) == "" { - io.WriteString(stderr, "error: ask add requires a description\n") + _, _ = io.WriteString(stderr, "error: ask add requires a description\n") return 1, nil } dependencyUUIDs, code, err := d.resolveAddDependencyUUIDs(ctx, dependencySelectors, stderr) @@ -42,7 +42,7 @@ func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stder } uuid := extractUUIDFromAddOutput(outBuf.String()) if uuid == "" { - io.WriteString(stderr, "error: could not parse UUID from task creation output\n") + _, _ = io.WriteString(stderr, "error: could not parse UUID from task creation output\n") return 1, nil } aliases, err := ensureTaskAliasesForUUIDs([]string{uuid}) @@ -50,7 +50,7 @@ func (d *Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stder fmt.Fprintf(stderr, "error: failed to assign task alias: %v\n", err) return 1, nil } - io.WriteString(stdout, displayTaskAlias(uuid, aliases)+"\n") + _, _ = io.WriteString(stdout, displayTaskAlias(uuid, aliases)+"\n") return 0, nil } diff --git a/internal/askcli/command_delete.go b/internal/askcli/command_delete.go index 4e93add..801d4cf 100644 --- a/internal/askcli/command_delete.go +++ b/internal/askcli/command_delete.go @@ -8,7 +8,7 @@ import ( func (d *Dispatcher) handleDelete(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask delete requires an ID or UUID argument\n") + _, _ = io.WriteString(stderr, "error: ask delete requires an ID or UUID argument\n") return 1, nil } resolved, _, code, err := d.resolveTaskSelector(ctx, args[1], stderr) @@ -21,6 +21,6 @@ func (d *Dispatcher) handleDelete(ctx context.Context, args []string, stdin io.R if code != 0 { return code, err } - io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) + _, _ = io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) return 0, nil } diff --git a/internal/askcli/command_delete_test.go b/internal/askcli/command_delete_test.go index 6161d39..62d3e48 100644 --- a/internal/askcli/command_delete_test.go +++ b/internal/askcli/command_delete_test.go @@ -30,7 +30,7 @@ func TestHandleDelete_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid-123" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid-123","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid-123","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -105,7 +105,7 @@ func TestHandleDelete_PassesCorrectArgs(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } capturedArgs = args @@ -139,7 +139,7 @@ func TestHandleDelete_AliasSelector(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid-123" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid-123","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid-123","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } capturedArgs = args diff --git a/internal/askcli/command_dep.go b/internal/askcli/command_dep.go index 83a4803..aa28df8 100644 --- a/internal/askcli/command_dep.go +++ b/internal/askcli/command_dep.go @@ -10,7 +10,7 @@ import ( func (d *Dispatcher) handleDep(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask dep requires an operation (add/rm/list) and arguments\n") + _, _ = io.WriteString(stderr, "error: ask dep requires an operation (add/rm/list) and arguments\n") return 1, nil } op := args[1] @@ -27,7 +27,7 @@ func (d *Dispatcher) handleDep(ctx context.Context, args []string, stdout, stder func (d *Dispatcher) handleDepAddRm(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 4 { - io.WriteString(stderr, "error: ask dep add/rm requires <id|uuid> <dep-id|dep-uuid>\n") + _, _ = io.WriteString(stderr, "error: ask dep add/rm requires <id|uuid> <dep-id|dep-uuid>\n") return 1, nil } resolved, _, code, err := d.resolveTaskSelector(ctx, args[2], stderr) @@ -53,13 +53,13 @@ func (d *Dispatcher) handleDepAddRm(ctx context.Context, args []string, stdout, if code != 0 { return code, err } - io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) + _, _ = io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) return 0, nil } func (d *Dispatcher) handleDepList(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask dep list requires <id|uuid>\n") + _, _ = io.WriteString(stderr, "error: ask dep list requires <id|uuid>\n") return 1, nil } _, tasks, code, err := d.resolveTaskSelector(ctx, args[2], stderr) @@ -68,12 +68,12 @@ func (d *Dispatcher) handleDepList(ctx context.Context, args []string, stdout, s return code, nil } if len(tasks) == 0 { - io.WriteString(stdout, "no dependencies\n") + _, _ = io.WriteString(stdout, "no dependencies\n") return 0, nil } task := tasks[0] if len(task.Depends) == 0 { - io.WriteString(stdout, "no dependencies\n") + _, _ = io.WriteString(stdout, "no dependencies\n") } else { aliases, err := ensureTaskAliasesForUUIDs(task.Depends) if err != nil { @@ -84,7 +84,7 @@ func (d *Dispatcher) handleDepList(ctx context.Context, args []string, stdout, s for _, uuid := range task.Depends { ids = append(ids, displayTaskAlias(uuid, aliases)) } - io.WriteString(stdout, strings.Join(ids, "\n")+"\n") + _, _ = io.WriteString(stdout, strings.Join(ids, "\n")+"\n") } return 0, nil } diff --git a/internal/askcli/command_dep_test.go b/internal/askcli/command_dep_test.go index 93e5175..4cbcd26 100644 --- a/internal/askcli/command_dep_test.go +++ b/internal/askcli/command_dep_test.go @@ -34,9 +34,9 @@ func TestHandleDep_AddSuccess(t *testing.T) { if len(args) == 2 && args[1] == "export" { switch args[0] { case "uuid:uuid-1": - io.WriteString(stdout, `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) case "uuid:uuid-2": - io.WriteString(stdout, `[{"uuid":"uuid-2","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-2","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) } return 0, nil } @@ -72,9 +72,9 @@ func TestHandleDep_RmSuccess(t *testing.T) { if len(args) == 2 && args[1] == "export" { switch args[0] { case "uuid:uuid-1": - io.WriteString(stdout, `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) case "uuid:uuid-2": - io.WriteString(stdout, `[{"uuid":"uuid-2","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-2","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":[]}]`) } return 0, nil } @@ -109,7 +109,7 @@ func TestHandleDep_ListSuccess(t *testing.T) { jsonData := `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":["dep-1","dep-2"]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil }}) var stdout, stderr bytes.Buffer @@ -135,7 +135,7 @@ func TestHandleDep_ListAssignsAliasForUnknownDependency(t *testing.T) { jsonData := `[{"uuid":"uuid-1","description":"Task","status":"pending","priority":"M","tags":[],"urgency":10,"depends":["dep-1"]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil }}) var stdout, stderr bytes.Buffer @@ -178,7 +178,7 @@ func TestHandleDep_AcceptUUIDPrefix(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[1] == "export" { capturedArgs = args - io.WriteString(stdout, export) + _, _ = io.WriteString(stdout, export) return 0, nil } capturedArgs = args @@ -220,9 +220,9 @@ func TestHandleDep_AliasSelectors(t *testing.T) { if len(args) == 2 && args[1] == "export" { switch args[0] { case "uuid:uuid-1": - io.WriteString(stdout, `[{"uuid":"uuid-1","description":"T1","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-1","description":"T1","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) case "uuid:uuid-2": - io.WriteString(stdout, `[{"uuid":"uuid-2","description":"T2","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"uuid-2","description":"T2","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) } return 0, nil } diff --git a/internal/askcli/command_info.go b/internal/askcli/command_info.go index 37fb49b..646ff8a 100644 --- a/internal/askcli/command_info.go +++ b/internal/askcli/command_info.go @@ -21,8 +21,8 @@ func (d *Dispatcher) handleInfo(ctx context.Context, args []string, stdout, stde fmt.Fprintf(stderr, "error: failed to marshal JSON: %v\n", err) return 1, nil } - stdout.Write(data) - io.WriteString(stdout, "\n") + _, _ = stdout.Write(data) + _, _ = io.WriteString(stdout, "\n") } else { allUUIDs := append([]string{tasks[0].UUID}, tasks[0].Depends...) aliases, err := ensureTaskAliasesForUUIDs(allUUIDs) @@ -30,7 +30,7 @@ func (d *Dispatcher) handleInfo(ctx context.Context, args []string, stdout, stde fmt.Fprintf(stderr, "error: failed to load task aliases: %v\n", err) return 1, nil } - io.WriteString(stdout, FormatTaskInfo(tasks[0], displayTaskAlias(tasks[0].UUID, aliases), aliases)) + _, _ = io.WriteString(stdout, FormatTaskInfo(tasks[0], displayTaskAlias(tasks[0].UUID, aliases), aliases)) } return 0, nil } @@ -77,7 +77,7 @@ func (d *Dispatcher) exportTasks(ctx context.Context, args []string, stderr io.W func writeInfoError(stderr io.Writer, err error) { msg := err.Error() if strings.HasPrefix(msg, "error:") { - io.WriteString(stderr, msg+"\n") + _, _ = io.WriteString(stderr, msg+"\n") return } fmt.Fprintf(stderr, "error: %v\n", err) diff --git a/internal/askcli/command_info_add_test.go b/internal/askcli/command_info_add_test.go index b8d911c..3dc83ed 100644 --- a/internal/askcli/command_info_add_test.go +++ b/internal/askcli/command_info_add_test.go @@ -33,7 +33,7 @@ func TestHandleInfo_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { // args[0] is "uuid:<uuid>" (the filter); emit data for any export call if len(args) > 0 && strings.HasPrefix(args[0], "uuid:") { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) } return 0, nil }}) @@ -81,7 +81,7 @@ func TestHandleInfo_AssignsDependencyAliasesFromInfo(t *testing.T) { jsonData := `[{"uuid":"test-uuid","description":"Test task","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":["dep-b","dep-a"]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) > 0 && strings.HasPrefix(args[0], "uuid:") { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) } return 0, nil }}) @@ -121,7 +121,7 @@ func TestHandleInfo_AliasSelector(t *testing.T) { jsonData := `[{"uuid":"test-uuid","description":"Test task","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) > 0 && strings.HasPrefix(args[0], "uuid:test-uuid") { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) } return 0, nil }}) @@ -161,7 +161,7 @@ func TestHandleInfo_MissingUUID(t *testing.T) { jsonData := `[{"uuid":"started-uuid","description":"Started task","status":"pending","priority":"M","start":"2026-03-26T10:00:00Z","urgency":5.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "started" && args[1] == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) } return 0, nil }}) @@ -178,7 +178,7 @@ func TestHandleInfo_MissingUUID(t *testing.T) { func TestHandleInfo_MissingUUID_NoStartedTask(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "started" && args[1] == "export" { - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") } return 0, nil }}) @@ -196,7 +196,7 @@ func TestHandleInfo_MissingUUID_MultipleStartedTasks(t *testing.T) { jsonData := `[{"uuid":"started-1","description":"Started task 1","status":"pending","priority":"M","start":"2026-03-26T10:00:00Z","urgency":5.0,"depends":[]},{"uuid":"started-2","description":"Started task 2","status":"pending","priority":"H","start":"2026-03-26T11:00:00Z","urgency":8.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "started" && args[1] == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) } return 0, nil }}) @@ -223,7 +223,7 @@ func TestHandleAdd_Success(t *testing.T) { }) d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, "Created task abc-123-def.") + _, _ = io.WriteString(stdout, "Created task abc-123-def.") return 0, nil }}) var stdout, stderr bytes.Buffer @@ -247,7 +247,7 @@ func TestHandleAdd_AliasAssignmentFailure(t *testing.T) { defer func() { taskAliasCacheRoot = oldRoot }() d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, "Created task abc-123-def.") + _, _ = io.WriteString(stdout, "Created task abc-123-def.") return 0, nil }}) @@ -302,7 +302,7 @@ func TestHandleAdd_MultipleWords(t *testing.T) { var capturedArgs []string d := NewDispatcher(makeAddRunner(func(args []string, stdout io.Writer) { capturedArgs = args - io.WriteString(stdout, "Created task test-uuid.") + _, _ = io.WriteString(stdout, "Created task test-uuid.") })) var stdout, stderr bytes.Buffer d.Dispatch(context.Background(), []string{"add", "Multi", "word", "description"}, nil, &stdout, &stderr) @@ -316,7 +316,7 @@ func TestHandleAdd_WithPriority(t *testing.T) { var capturedArgs []string d := NewDispatcher(makeAddRunner(func(args []string, stdout io.Writer) { capturedArgs = args - io.WriteString(stdout, "Created task test-uuid.") + _, _ = io.WriteString(stdout, "Created task test-uuid.") })) var stdout, stderr bytes.Buffer code, _ := d.Dispatch(context.Background(), []string{"add", "priority:H", "Fix critical bug"}, nil, &stdout, &stderr) @@ -339,7 +339,7 @@ func TestHandleAdd_WithTag(t *testing.T) { var capturedArgs []string d := NewDispatcher(makeAddRunner(func(args []string, stdout io.Writer) { capturedArgs = args - io.WriteString(stdout, "Created task test-uuid.") + _, _ = io.WriteString(stdout, "Created task test-uuid.") })) var stdout, stderr bytes.Buffer code, _ := d.Dispatch(context.Background(), []string{"add", "+cli", "New feature"}, nil, &stdout, &stderr) @@ -356,7 +356,7 @@ func TestHandleAdd_WithPriorityAndTag(t *testing.T) { var capturedArgs []string d := NewDispatcher(makeAddRunner(func(args []string, stdout io.Writer) { capturedArgs = args - io.WriteString(stdout, "Created task test-uuid.") + _, _ = io.WriteString(stdout, "Created task test-uuid.") })) var stdout, stderr bytes.Buffer code, _ := d.Dispatch(context.Background(), []string{"add", "priority:H", "+cli", "Complex task"}, nil, &stdout, &stderr) @@ -383,12 +383,12 @@ func TestHandleAdd_WithDependencies(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { switch { case len(args) >= 2 && args[0] == "uuid:dep-uuid-1" && args[1] == "export": - io.WriteString(stdout, `[{"uuid":"dep-uuid-1","description":"Dependency one","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"dep-uuid-1","description":"Dependency one","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) case len(args) >= 2 && args[0] == "uuid:dep-uuid-2" && args[1] == "export": - io.WriteString(stdout, `[{"uuid":"dep-uuid-2","description":"Dependency two","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"dep-uuid-2","description":"Dependency two","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) case len(args) >= 1 && args[0] == "add": capturedAddArgs = append([]string(nil), args...) - io.WriteString(stdout, "Created task created-uuid.") + _, _ = io.WriteString(stdout, "Created task created-uuid.") default: t.Fatalf("unexpected runner args: %v", args) } diff --git a/internal/askcli/command_list_test.go b/internal/askcli/command_list_test.go index 83dc1b8..e25293e 100644 --- a/internal/askcli/command_list_test.go +++ b/internal/askcli/command_list_test.go @@ -33,7 +33,7 @@ func TestHandleList_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { for _, arg := range args { if arg == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil } } @@ -79,7 +79,7 @@ func TestHandleList_SortedByPriority(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { for _, arg := range args { if arg == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil } } @@ -99,7 +99,7 @@ func TestHandleList_EmptyList(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { for _, arg := range args { if arg == "export" { - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") return 0, nil } } @@ -134,7 +134,7 @@ func TestHandleAll_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { for _, arg := range args { if arg == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil } } @@ -172,7 +172,7 @@ func TestHandleReady_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { for _, arg := range args { if arg == "export" { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil } } @@ -192,7 +192,7 @@ func TestHandleList_PassesFilters(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { capturedArgs = args - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") return 0, nil }}) var stdout, stderr bytes.Buffer diff --git a/internal/askcli/command_urgency_test.go b/internal/askcli/command_urgency_test.go index dd6262d..2582e58 100644 --- a/internal/askcli/command_urgency_test.go +++ b/internal/askcli/command_urgency_test.go @@ -31,7 +31,7 @@ func TestHandleUrgency_Success(t *testing.T) { jsonData := `[{"uuid":"uuid-2","description":"Task 2","status":"pending","priority":"M","tags":["agent"],"urgency":10.0,"depends":[]},{"uuid":"uuid-1","description":"Task 1","status":"pending","priority":"H","tags":["cli"],"urgency":15.0,"depends":[]}]` d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, jsonData) + _, _ = io.WriteString(stdout, jsonData) return 0, nil }}) var stdout, stderr bytes.Buffer @@ -56,7 +56,7 @@ func TestHandleUrgency_Success(t *testing.T) { func TestHandleUrgency_EmptyList(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") return 0, nil }}) var stdout, stderr bytes.Buffer @@ -81,7 +81,7 @@ func TestHandleUrgency_PassesCorrectArgs(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { capturedArgs = args - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") return 0, nil }}) var stdout, stderr bytes.Buffer diff --git a/internal/askcli/command_write.go b/internal/askcli/command_write.go index 023251c..d8dbf5b 100644 --- a/internal/askcli/command_write.go +++ b/internal/askcli/command_write.go @@ -25,13 +25,13 @@ func (d *Dispatcher) runSingleTaskCommand( return code, err } - io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) + _, _ = io.WriteString(stdout, FormatSuccess(displayResolvedTaskID(resolved))) return 0, nil } func (d *Dispatcher) handleDenotate(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask denotate requires an ID or UUID and text argument\n") + _, _ = io.WriteString(stderr, "error: ask denotate requires an ID or UUID and text argument\n") return 1, nil } text := args[2] @@ -42,7 +42,7 @@ func (d *Dispatcher) handleDenotate(ctx context.Context, args []string, stdout, func (d *Dispatcher) handleModify(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask modify requires an ID or UUID and modification args\n") + _, _ = io.WriteString(stderr, "error: ask modify requires an ID or UUID and modification args\n") return 1, nil } modArgs := args[2:] @@ -53,7 +53,7 @@ func (d *Dispatcher) handleModify(ctx context.Context, args []string, stdout, st func (d *Dispatcher) handleAnnotate(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask annotate requires an ID or UUID and note argument\n") + _, _ = io.WriteString(stderr, "error: ask annotate requires an ID or UUID and note argument\n") return 1, nil } note := strings.Join(args[2:], " ") @@ -64,7 +64,7 @@ func (d *Dispatcher) handleAnnotate(ctx context.Context, args []string, stdout, func (d *Dispatcher) handleStart(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask start requires an ID or UUID argument\n") + _, _ = io.WriteString(stderr, "error: ask start requires an ID or UUID argument\n") return 1, nil } return d.runSingleTaskCommand(ctx, args[1], stdout, stderr, func(resolved resolvedTaskSelector) []string { @@ -76,7 +76,7 @@ func (d *Dispatcher) handleStart(ctx context.Context, args []string, stdout, std func (d *Dispatcher) handleStop(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask stop requires an ID or UUID argument\n") + _, _ = io.WriteString(stderr, "error: ask stop requires an ID or UUID argument\n") return 1, nil } return d.runSingleTaskCommand(ctx, args[1], stdout, stderr, func(resolved resolvedTaskSelector) []string { @@ -86,7 +86,7 @@ func (d *Dispatcher) handleStop(ctx context.Context, args []string, stdout, stde func (d *Dispatcher) handleDone(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 2 { - io.WriteString(stderr, "error: ask done requires an ID or UUID argument\n") + _, _ = io.WriteString(stderr, "error: ask done requires an ID or UUID argument\n") return 1, nil } return d.runSingleTaskCommand(ctx, args[1], stdout, stderr, func(resolved resolvedTaskSelector) []string { @@ -96,7 +96,7 @@ func (d *Dispatcher) handleDone(ctx context.Context, args []string, stdout, stde func (d *Dispatcher) handlePriority(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask priority requires an ID or UUID and priority (H/M/L)\n") + _, _ = io.WriteString(stderr, "error: ask priority requires an ID or UUID and priority (H/M/L)\n") return 1, nil } priority := args[2] @@ -107,7 +107,7 @@ func (d *Dispatcher) handlePriority(ctx context.Context, args []string, stdout, func (d *Dispatcher) handleTag(ctx context.Context, args []string, stdout, stderr io.Writer) (int, error) { if len(args) < 3 { - io.WriteString(stderr, "error: ask tag requires an ID or UUID and +/-tag\n") + _, _ = io.WriteString(stderr, "error: ask tag requires an ID or UUID and +/-tag\n") return 1, nil } tag := args[2] diff --git a/internal/askcli/command_write_test.go b/internal/askcli/command_write_test.go index 17935e3..e922920 100644 --- a/internal/askcli/command_write_test.go +++ b/internal/askcli/command_write_test.go @@ -40,7 +40,7 @@ func TestHandleStart_AliasSelector(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } capturedArgs = args @@ -69,7 +69,7 @@ func TestHandleDenotate_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -126,7 +126,7 @@ func TestHandleModify_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -165,7 +165,7 @@ func TestHandleAnnotate_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -207,7 +207,7 @@ func TestHandleStart_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -242,7 +242,7 @@ func TestHandleStop_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -259,7 +259,7 @@ func TestHandleDone_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -276,7 +276,7 @@ func TestHandlePriority_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -308,7 +308,7 @@ func TestHandleTag_Success(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 0, nil @@ -357,7 +357,7 @@ func TestAllWriteHandlers_PassCorrectArgs(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } capturedArgs = args @@ -403,7 +403,7 @@ func TestAllWriteHandlers_AcceptUUIDPrefix(t *testing.T) { var capturedArgs []string d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"my-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } capturedArgs = args @@ -460,7 +460,7 @@ func TestRunSingleTaskCommand_RunFailureDoesNotWriteSuccess(t *testing.T) { runErr := errors.New("runner failed") d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:test-uuid" && args[1] == "export" { - io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) + _, _ = io.WriteString(stdout, `[{"uuid":"test-uuid","description":"Task","status":"pending","priority":"M","tags":[],"urgency":0,"depends":[]}]`) return 0, nil } return 2, runErr diff --git a/internal/askcli/dispatch.go b/internal/askcli/dispatch.go index f714bc1..4612555 100644 --- a/internal/askcli/dispatch.go +++ b/internal/askcli/dispatch.go @@ -89,27 +89,27 @@ func (d *Dispatcher) Dispatch(ctx context.Context, args []string, stdin io.Reade } func (d *Dispatcher) help(w io.Writer) (int, error) { - io.WriteString(w, "ask - task management CLI\n") - io.WriteString(w, "\nSubcommands:\n") - io.WriteString(w, " ask add [mods...] [depends:<id|uuid>,...] <description...> Create a new task and print its ID\n") - io.WriteString(w, " ask list [filters] List active tasks (default)\n") - io.WriteString(w, " ask ready List READY tasks (not blocked)\n") - io.WriteString(w, " ask all [filters] List all tasks including completed/deleted\n") - io.WriteString(w, " ask info [id|uuid] Show task details or current started task\n") - io.WriteString(w, " ask annotate <id|uuid> \"note\" Add annotation to task\n") - io.WriteString(w, " ask start <id|uuid> Start working on task\n") - io.WriteString(w, " ask stop <id|uuid> Stop work on a task\n") - io.WriteString(w, " ask done <id|uuid> Mark task complete\n") - io.WriteString(w, " ask priority <id|uuid> <P> Set priority (H/M/L)\n") - io.WriteString(w, " ask tag <id|uuid> +/-<tag> Add or remove tag\n") - io.WriteString(w, " ask dep add <id|uuid> <dep> Add dependency\n") - io.WriteString(w, " ask dep rm <id|uuid> <dep> Remove dependency\n") - io.WriteString(w, " ask dep list <id|uuid> List dependencies\n") - io.WriteString(w, " ask urgency List tasks sorted by urgency\n") - io.WriteString(w, " ask modify <id|uuid> <args...> Modify task fields\n") - io.WriteString(w, " ask denotate <id|uuid> \"text\" Remove annotation\n") - io.WriteString(w, " ask delete <id|uuid> Delete a task\n") - io.WriteString(w, " ask fish Emit Fish shell completion script\n") + _, _ = io.WriteString(w, "ask - task management CLI\n") + _, _ = io.WriteString(w, "\nSubcommands:\n") + _, _ = io.WriteString(w, " ask add [mods...] [depends:<id|uuid>,...] <description...> Create a new task and print its ID\n") + _, _ = io.WriteString(w, " ask list [filters] List active tasks (default)\n") + _, _ = io.WriteString(w, " ask ready List READY tasks (not blocked)\n") + _, _ = io.WriteString(w, " ask all [filters] List all tasks including completed/deleted\n") + _, _ = io.WriteString(w, " ask info [id|uuid] Show task details or current started task\n") + _, _ = io.WriteString(w, " ask annotate <id|uuid> \"note\" Add annotation to task\n") + _, _ = io.WriteString(w, " ask start <id|uuid> Start working on task\n") + _, _ = io.WriteString(w, " ask stop <id|uuid> Stop work on a task\n") + _, _ = io.WriteString(w, " ask done <id|uuid> Mark task complete\n") + _, _ = io.WriteString(w, " ask priority <id|uuid> <P> Set priority (H/M/L)\n") + _, _ = io.WriteString(w, " ask tag <id|uuid> +/-<tag> Add or remove tag\n") + _, _ = io.WriteString(w, " ask dep add <id|uuid> <dep> Add dependency\n") + _, _ = io.WriteString(w, " ask dep rm <id|uuid> <dep> Remove dependency\n") + _, _ = io.WriteString(w, " ask dep list <id|uuid> List dependencies\n") + _, _ = io.WriteString(w, " ask urgency List tasks sorted by urgency\n") + _, _ = io.WriteString(w, " ask modify <id|uuid> <args...> Modify task fields\n") + _, _ = io.WriteString(w, " ask denotate <id|uuid> \"text\" Remove annotation\n") + _, _ = io.WriteString(w, " ask delete <id|uuid> Delete a task\n") + _, _ = io.WriteString(w, " ask fish Emit Fish shell completion script\n") return 0, nil } diff --git a/internal/askcli/formatter.go b/internal/askcli/formatter.go index 9dfaf4a..743637b 100644 --- a/internal/askcli/formatter.go +++ b/internal/askcli/formatter.go @@ -72,7 +72,7 @@ func writeTaskListHeader(b *strings.Builder, widths taskListWidths) { func writeTaskListSeparator(b *strings.Builder, widths taskListWidths) { total := widths.Urgency + widths.Priority + widths.ID + widths.Status + widths.Started + widths.Tags + widths.Description + 18 - io.WriteString(b, strings.Repeat("-", total)+"\n") + _, _ = io.WriteString(b, strings.Repeat("-", total)+"\n") } func writeTaskListRow(b *strings.Builder, widths taskListWidths, t TaskExport, aliases map[string]string) { @@ -152,7 +152,7 @@ func FormatTaskInfo(t TaskExport, alias string, dependencyAliases map[string]str fmt.Fprintf(&b, "Depends: %s\n", formatTaskDependencies(t.Depends, dependencyAliases)) } if len(t.Annotations) > 0 { - io.WriteString(&b, "Annotations:\n") + _, _ = io.WriteString(&b, "Annotations:\n") for _, a := range t.Annotations { fmt.Fprintf(&b, " - %s (added %s)\n", a.Description, a.Entry) } diff --git a/internal/askcli/render_task_list.go b/internal/askcli/render_task_list.go index 1c0da8c..33487e5 100644 --- a/internal/askcli/render_task_list.go +++ b/internal/askcli/render_task_list.go @@ -15,8 +15,8 @@ func renderTaskList(tasks []TaskExport, stdout, stderr io.Writer, jsonOutput boo fmt.Fprintf(stderr, "error: failed to marshal JSON: %v\n", err) return 1, nil } - stdout.Write(data) - io.WriteString(stdout, "\n") + _, _ = stdout.Write(data) + _, _ = io.WriteString(stdout, "\n") return 0, nil } @@ -25,6 +25,6 @@ func renderTaskList(tasks []TaskExport, stdout, stderr io.Writer, jsonOutput boo fmt.Fprintf(stderr, "error: failed to load task aliases: %v\n", err) return 1, nil } - io.WriteString(stdout, FormatTaskListForWidth(tasks, aliases, detectTaskListTerminalWidth(stdout))) + _, _ = io.WriteString(stdout, FormatTaskListForWidth(tasks, aliases, detectTaskListTerminalWidth(stdout))) return 0, nil } diff --git a/internal/askcli/task_selector_test.go b/internal/askcli/task_selector_test.go index 7e60665..e882a0b 100644 --- a/internal/askcli/task_selector_test.go +++ b/internal/askcli/task_selector_test.go @@ -113,7 +113,7 @@ func TestHandleInfo_StaleAlias(t *testing.T) { d := NewDispatcher(&spyRunner{runFn: func(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) { if len(args) == 2 && args[0] == "uuid:task-uuid-1" && args[1] == "export" { - io.WriteString(stdout, "[]") + _, _ = io.WriteString(stdout, "[]") } return 0, nil }}) |
