summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-26 22:09:29 +0200
committerPaul Buetow <paul@buetow.org>2026-03-26 22:09:29 +0200
commitc9d96d4c1918881f771165e97e71de49917d4181 (patch)
tree4992fca4e8684468cba897624a92e5efe41180be /internal
parentb10c6247e14a3acfe20e78426e131691e205a601 (diff)
ask: silence rc.confirmation override banner
Diffstat (limited to 'internal')
-rw-r--r--internal/askcli/command_info_add.go6
-rw-r--r--internal/askcli/command_info_add_test.go28
-rw-r--r--internal/askcli/taskexec.go7
-rw-r--r--internal/askcli/taskexec_test.go4
4 files changed, 23 insertions, 22 deletions
diff --git a/internal/askcli/command_info_add.go b/internal/askcli/command_info_add.go
index 025b104..11aea7b 100644
--- a/internal/askcli/command_info_add.go
+++ b/internal/askcli/command_info_add.go
@@ -50,9 +50,9 @@ func (d Dispatcher) handleAdd(ctx context.Context, args []string, stdout, stderr
}
modifiers, description := parseAddArgs(args[1:])
var outBuf bytes.Buffer
- // rc.verbose=new-uuid instructs taskwarrior to emit "Created task <uuid>."
- // so we get the UUID directly from the add output without a follow-up export.
- taskArgs := []string{"add", "rc.verbose=new-uuid"}
+ // rc.verbose=nothing keeps Taskwarrior quiet by default. rc.verbose=new-uuid
+ // then re-enables the UUID-only confirmation we parse below.
+ taskArgs := []string{"add", "rc.verbose=nothing", "rc.verbose=new-uuid"}
taskArgs = append(taskArgs, modifiers...)
taskArgs = append(taskArgs, description)
code, err := d.runner.Run(ctx, taskArgs, nil, &outBuf, stderr)
diff --git a/internal/askcli/command_info_add_test.go b/internal/askcli/command_info_add_test.go
index f4dc5c1..fc36930 100644
--- a/internal/askcli/command_info_add_test.go
+++ b/internal/askcli/command_info_add_test.go
@@ -95,9 +95,9 @@ func TestHandleAdd_MultipleWords(t *testing.T) {
}))
var stdout, stderr bytes.Buffer
d.Dispatch(context.Background(), []string{"add", "Multi", "word", "description"}, nil, &stdout, &stderr)
- // args[0]="add", args[1]="rc.verbose=new-uuid", then description
- if len(capturedArgs) < 3 || capturedArgs[0] != "add" || capturedArgs[1] != "rc.verbose=new-uuid" {
- t.Fatalf("capturedArgs = %v, want [add, rc.verbose=new-uuid, ...]", capturedArgs)
+ // args[0]="add", args[1]="rc.verbose=nothing", args[2]="rc.verbose=new-uuid"
+ if len(capturedArgs) < 4 || capturedArgs[0] != "add" || capturedArgs[1] != "rc.verbose=nothing" || capturedArgs[2] != "rc.verbose=new-uuid" {
+ t.Fatalf("capturedArgs = %v, want [add, rc.verbose=nothing, rc.verbose=new-uuid, ...]", capturedArgs)
}
}
@@ -112,12 +112,12 @@ func TestHandleAdd_WithPriority(t *testing.T) {
if code != 0 {
t.Fatalf("add code = %d, want 0", code)
}
- // args: [add, rc.verbose=new-uuid, priority:H, Fix critical bug]
- if len(capturedArgs) < 4 {
- t.Fatalf("capturedArgs = %v, want at least 4 elements", capturedArgs)
+ // args: [add, rc.verbose=nothing, rc.verbose=new-uuid, priority:H, Fix critical bug]
+ if len(capturedArgs) < 5 {
+ t.Fatalf("capturedArgs = %v, want at least 5 elements", capturedArgs)
}
- if capturedArgs[2] != "priority:H" {
- t.Errorf("capturedArgs[2] = %s, want priority:H", capturedArgs[2])
+ if capturedArgs[3] != "priority:H" {
+ t.Errorf("capturedArgs[3] = %s, want priority:H", capturedArgs[3])
}
if capturedArgs[len(capturedArgs)-1] != "Fix critical bug" {
t.Errorf("last arg = %s, want 'Fix critical bug'", capturedArgs[len(capturedArgs)-1])
@@ -135,9 +135,9 @@ func TestHandleAdd_WithTag(t *testing.T) {
if code != 0 {
t.Fatalf("add code = %d, want 0", code)
}
- // args: [add, rc.verbose=new-uuid, +cli, New feature]
- if capturedArgs[2] != "+cli" {
- t.Errorf("capturedArgs[2] = %s, want +cli", capturedArgs[2])
+ // args: [add, rc.verbose=nothing, rc.verbose=new-uuid, +cli, New feature]
+ if capturedArgs[3] != "+cli" {
+ t.Errorf("capturedArgs[3] = %s, want +cli", capturedArgs[3])
}
}
@@ -152,9 +152,9 @@ func TestHandleAdd_WithPriorityAndTag(t *testing.T) {
if code != 0 {
t.Fatalf("add code = %d, want 0", code)
}
- // args: [add, rc.verbose=new-uuid, priority:H, +cli, Complex task]
- if capturedArgs[2] != "priority:H" || capturedArgs[3] != "+cli" {
- t.Errorf("capturedArgs = %v, want [add, rc.verbose=new-uuid, priority:H, +cli, Complex task]", capturedArgs)
+ // args: [add, rc.verbose=nothing, rc.verbose=new-uuid, priority:H, +cli, Complex task]
+ if capturedArgs[3] != "priority:H" || capturedArgs[4] != "+cli" {
+ t.Errorf("capturedArgs = %v, want [add, rc.verbose=nothing, rc.verbose=new-uuid, priority:H, +cli, Complex task]", capturedArgs)
}
}
diff --git a/internal/askcli/taskexec.go b/internal/askcli/taskexec.go
index 0553070..59d9b55 100644
--- a/internal/askcli/taskexec.go
+++ b/internal/askcli/taskexec.go
@@ -37,9 +37,10 @@ func (e Executor) taskArgs(repoRoot string, args []string) ([]string, error) {
if err != nil {
return nil, err
}
- // rc.confirmation=off suppresses interactive prompts so the CLI works
- // non-interactively (stdin is never available when called from an agent).
- return append([]string{"rc.confirmation=off", "project:" + projectName, "+agent"}, args...), nil
+ // rc.verbose=nothing suppresses Taskwarrior's configuration override
+ // banner, while rc.confirmation=off keeps non-interactive commands from
+ // prompting when stdin is unavailable.
+ return append([]string{"rc.verbose=nothing", "rc.confirmation=off", "project:" + projectName, "+agent"}, args...), nil
}
func (e Executor) Run(ctx context.Context, args []string, stdin io.Reader, stdout, stderr io.Writer) (int, error) {
diff --git a/internal/askcli/taskexec_test.go b/internal/askcli/taskexec_test.go
index 5cbb7f1..2492aae 100644
--- a/internal/askcli/taskexec_test.go
+++ b/internal/askcli/taskexec_test.go
@@ -17,7 +17,7 @@ func TestExecutorTaskArgs(t *testing.T) {
if err != nil {
t.Fatalf("taskArgs returned error: %v", err)
}
- want := []string{"rc.confirmation=off", "project:hexai", "+agent", "list", "limit:1"}
+ want := []string{"rc.verbose=nothing", "rc.confirmation=off", "project:hexai", "+agent", "list", "limit:1"}
if !reflect.DeepEqual(args, want) {
t.Fatalf("task args = %v, want %v", args, want)
}
@@ -47,7 +47,7 @@ func TestExecutorRun_InjectsProjectFilterAndAgentTag(t *testing.T) {
if gotName != "/usr/bin/task" {
t.Fatalf("task binary = %q, want /usr/bin/task", gotName)
}
- wantArgs := []string{"rc.confirmation=off", "project:hexai", "+agent", "list", "limit:1"}
+ wantArgs := []string{"rc.verbose=nothing", "rc.confirmation=off", "project:hexai", "+agent", "list", "limit:1"}
if !reflect.DeepEqual(gotArgs, wantArgs) {
t.Fatalf("task args = %v, want %v", gotArgs, wantArgs)
}