summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-11 22:20:57 +0300
committerPaul Buetow <paul@buetow.org>2026-04-11 22:20:57 +0300
commit69d3ec004b8de3b9f7cfeb34686b9c344c787db4 (patch)
tree857101184293efa61f9d1caba4c3b80b31e89a37 /integrationtests
parent5bc434d71fb5057131f1e5c0b2371db42d3b4ed4 (diff)
Rename task CLI binary from do back to ask
- Move cmd/do to cmd/ask; mage builds and installs ask; Fish completions to ask.fish - Update askcli help text, errors, executor default label, and Fish script (__ask_*) - Task alias cache subdirectory under XDG cache: hexai/ask/ - Rename integration test files and helpers; refresh README and docs - Rename plan-do-uuid-wrapper.md to plan-ask-uuid-wrapper.md Made-with: Cursor
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/ask_scope_test.go (renamed from integrationtests/do_scope_test.go)54
-rw-r--r--integrationtests/ask_test.go (renamed from integrationtests/do_test.go)160
2 files changed, 107 insertions, 107 deletions
diff --git a/integrationtests/do_scope_test.go b/integrationtests/ask_scope_test.go
index c87c67c..813bace 100644
--- a/integrationtests/do_scope_test.go
+++ b/integrationtests/ask_scope_test.go
@@ -13,7 +13,7 @@ import (
"codeberg.org/snonux/hexai/internal/askcli"
)
-func scopedDoArgs(scopePrefix string, args ...string) []string {
+func scopedAskArgs(scopePrefix string, args ...string) []string {
if strings.TrimSpace(scopePrefix) == "" {
return append([]string(nil), args...)
}
@@ -22,28 +22,28 @@ func scopedDoArgs(scopePrefix string, args ...string) []string {
}
func createTaskInScope(ctx context.Context, scopePrefix, desc string) (taskInfo, error) {
- stdout, stderr, code := runDo(ctx, scopedDoArgs(scopePrefix, "add", "+integrationtest", desc))
+ stdout, stderr, code := runAsk(ctx, scopedAskArgs(scopePrefix, "add", "+integrationtest", desc))
if code != 0 {
return taskInfo{}, fmt.Errorf("create task failed (code %d): stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
id := extractTaskIDFromAddOutput(stdout.String())
if id == "" {
- return taskInfo{}, fmt.Errorf("could not extract task ID from do add output: %s", stdout.String())
+ return taskInfo{}, fmt.Errorf("could not extract task ID from ask add output: %s", stdout.String())
}
info, ok := getTaskInfoInScope(ctx, scopePrefix, id)
if !ok {
- return taskInfo{}, fmt.Errorf("could not resolve task ID %q after do %s add", id, scopePrefix)
+ return taskInfo{}, fmt.Errorf("could not resolve task ID %q after ask %s add", id, scopePrefix)
}
if info.UUID == "" {
- return taskInfo{}, fmt.Errorf("do %s info %q did not return a UUID", scopePrefix, id)
+ return taskInfo{}, fmt.Errorf("ask %s info %q did not return a UUID", scopePrefix, id)
}
return info, nil
}
func getTaskInfoInScope(ctx context.Context, scopePrefix, selector string) (taskInfo, bool) {
- stdout, _, code := runDo(ctx, scopedDoArgs(scopePrefix, "info", selector))
+ stdout, _, code := runAsk(ctx, scopedAskArgs(scopePrefix, "info", selector))
if code != 0 {
return taskInfo{}, false
}
@@ -143,28 +143,28 @@ func TestNoAgentListSeparatesScopedTasks(t *testing.T) {
}
defer deleteTask(ctx, noAgentInfo.UUID)
- stdout, stderr, code := runDo(ctx, []string{"list"})
+ stdout, stderr, code := runAsk(ctx, []string{"list"})
if code != 0 {
- t.Fatalf("do list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("ask list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
if !strings.Contains(stdout.String(), agentDesc) {
- t.Fatalf("do list should contain agent task %q: %s", agentDesc, stdout.String())
+ t.Fatalf("ask list should contain agent task %q: %s", agentDesc, stdout.String())
}
if strings.Contains(stdout.String(), noAgentDesc) {
- t.Fatalf("do list should not contain no-agent task %q: %s", noAgentDesc, stdout.String())
+ t.Fatalf("ask list should not contain no-agent task %q: %s", noAgentDesc, stdout.String())
}
for _, prefix := range []string{"na", "no-agent"} {
t.Run(prefix, func(t *testing.T) {
- scopedStdout, scopedStderr, scopedCode := runDo(ctx, []string{prefix, "list"})
+ scopedStdout, scopedStderr, scopedCode := runAsk(ctx, []string{prefix, "list"})
if scopedCode != 0 {
- t.Fatalf("do %s list failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, scopedStdout.String(), scopedStderr.String())
+ t.Fatalf("ask %s list failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, scopedStdout.String(), scopedStderr.String())
}
if !strings.Contains(scopedStdout.String(), noAgentDesc) {
- t.Fatalf("do %s list should contain no-agent task %q: %s", prefix, noAgentDesc, scopedStdout.String())
+ t.Fatalf("ask %s list should contain no-agent task %q: %s", prefix, noAgentDesc, scopedStdout.String())
}
if strings.Contains(scopedStdout.String(), agentDesc) {
- t.Fatalf("do %s list should not contain agent task %q: %s", prefix, agentDesc, scopedStdout.String())
+ t.Fatalf("ask %s list should not contain agent task %q: %s", prefix, agentDesc, scopedStdout.String())
}
})
}
@@ -182,9 +182,9 @@ func TestNoAgentSelectorCommandsUseScopedTasks(t *testing.T) {
}
defer deleteTask(ctx, info.UUID)
- _, stderr, code := runDo(ctx, []string{"info", info.ID})
+ _, stderr, code := runAsk(ctx, []string{"info", info.ID})
if code == 0 {
- t.Fatalf("do info %s unexpectedly succeeded outside no-agent scope", info.ID)
+ t.Fatalf("ask info %s unexpectedly succeeded outside no-agent scope", info.ID)
}
if !strings.Contains(stderr.String(), "current scope") {
t.Fatalf("stderr = %q, want current-scope guidance", stderr.String())
@@ -192,19 +192,19 @@ func TestNoAgentSelectorCommandsUseScopedTasks(t *testing.T) {
for _, prefix := range []string{"na", "no-agent"} {
t.Run(prefix, func(t *testing.T) {
- stdout, scopedStderr, scopedCode := runDo(ctx, []string{prefix, "info", info.ID})
+ stdout, scopedStderr, scopedCode := runAsk(ctx, []string{prefix, "info", info.ID})
if scopedCode != 0 {
- t.Fatalf("do %s info failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, stdout.String(), scopedStderr.String())
+ t.Fatalf("ask %s info failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, stdout.String(), scopedStderr.String())
}
if !strings.Contains(stdout.String(), "UUID: "+info.UUID) {
- t.Fatalf("do %s info output missing UUID %q: %s", prefix, info.UUID, stdout.String())
+ t.Fatalf("ask %s info output missing UUID %q: %s", prefix, info.UUID, stdout.String())
}
})
}
- stdout, stderr, code := runDo(ctx, []string{"na", "done", info.ID})
+ stdout, stderr, code := runAsk(ctx, []string{"na", "done", info.ID})
if code != 0 {
- t.Fatalf("do na done failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("ask na done failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
task, err := exportTaskByUUID(ctx, info.UUID)
@@ -234,9 +234,9 @@ func TestNoAgentCompleteUUIDsUsesScopedTasks(t *testing.T) {
}
defer deleteTask(ctx, noAgentInfo.UUID)
- defaultStdout, defaultStderr, defaultCode := runDo(ctx, []string{"complete-uuids"})
+ defaultStdout, defaultStderr, defaultCode := runAsk(ctx, []string{"complete-uuids"})
if defaultCode != 0 {
- t.Fatalf("do complete-uuids failed with code %d: stdout=%s stderr=%s", defaultCode, defaultStdout.String(), defaultStderr.String())
+ t.Fatalf("ask complete-uuids failed with code %d: stdout=%s stderr=%s", defaultCode, defaultStdout.String(), defaultStderr.String())
}
if !hasSelectorLine(defaultStdout.String(), agentAlias) || !hasSelectorLine(defaultStdout.String(), agentUUID) {
t.Fatalf("default complete-uuids should contain agent selectors: %s", defaultStdout.String())
@@ -247,15 +247,15 @@ func TestNoAgentCompleteUUIDsUsesScopedTasks(t *testing.T) {
for _, prefix := range []string{"na", "no-agent"} {
t.Run(prefix, func(t *testing.T) {
- stdout, stderr, code := runDo(ctx, []string{prefix, "complete-uuids"})
+ stdout, stderr, code := runAsk(ctx, []string{prefix, "complete-uuids"})
if code != 0 {
- t.Fatalf("do %s complete-uuids failed with code %d: stdout=%s stderr=%s", prefix, code, stdout.String(), stderr.String())
+ t.Fatalf("ask %s complete-uuids failed with code %d: stdout=%s stderr=%s", prefix, code, stdout.String(), stderr.String())
}
if !hasSelectorLine(stdout.String(), noAgentInfo.ID) || !hasSelectorLine(stdout.String(), noAgentInfo.UUID) {
- t.Fatalf("do %s complete-uuids should contain no-agent selectors: %s", prefix, stdout.String())
+ t.Fatalf("ask %s complete-uuids should contain no-agent selectors: %s", prefix, stdout.String())
}
if hasSelectorLine(stdout.String(), agentAlias) || hasSelectorLine(stdout.String(), agentUUID) {
- t.Fatalf("do %s complete-uuids should not contain agent selectors: %s", prefix, stdout.String())
+ t.Fatalf("ask %s complete-uuids should not contain agent selectors: %s", prefix, stdout.String())
}
})
}
diff --git a/integrationtests/do_test.go b/integrationtests/ask_test.go
index a8e3bd5..c122ede 100644
--- a/integrationtests/do_test.go
+++ b/integrationtests/ask_test.go
@@ -44,12 +44,12 @@ func findRepoRoot() string {
return ""
}
-func doBinaryPath() string {
- return filepath.Join(repoRoot, "cmd", "do", "do")
+func askBinaryPath() string {
+ return filepath.Join(repoRoot, "cmd", "ask", "ask")
}
-func runDo(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
- cmd := exec.CommandContext(ctx, doBinaryPath(), args...)
+func runAsk(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
+ cmd := exec.CommandContext(ctx, askBinaryPath(), args...)
cmd.Dir = repoRoot
cmd.Stdout = &stdout
cmd.Stderr = &stderr
@@ -64,8 +64,8 @@ func runDo(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, exi
return stdout, stderr, ee.ExitCode()
}
-func runDoInDir(ctx context.Context, dir string, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
- cmd := exec.CommandContext(ctx, doBinaryPath(), args...)
+func runAskInDir(ctx context.Context, dir string, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
+ cmd := exec.CommandContext(ctx, askBinaryPath(), args...)
cmd.Dir = dir
cmd.Stdout = &stdout
cmd.Stderr = &stderr
@@ -80,10 +80,10 @@ func runDoInDir(ctx context.Context, dir string, args []string) (stdout, stderr
return stdout, stderr, ee.ExitCode()
}
-// runDoWithStdin runs do with the given stdin. Only use this for commands
+// runAskWithStdin runs ask with the given stdin. Only use this for commands
// that actually forward stdin to taskwarrior (currently only: delete).
-func runDoWithStdin(ctx context.Context, args []string, stdin string) (stdout, stderr bytes.Buffer, exitCode int) {
- cmd := exec.CommandContext(ctx, doBinaryPath(), args...)
+func runAskWithStdin(ctx context.Context, args []string, stdin string) (stdout, stderr bytes.Buffer, exitCode int) {
+ cmd := exec.CommandContext(ctx, askBinaryPath(), args...)
cmd.Dir = repoRoot
cmd.Stdin = strings.NewReader(stdin)
cmd.Stdout = &stdout
@@ -145,20 +145,20 @@ func runTaskWithStdin(ctx context.Context, args []string, stdin string) (stdout,
return stdout, stderr, ee.ExitCode()
}
-// createTask creates a new task via do add and returns its UUID.
-// do add prints a human-facing created-task message, so we resolve the created UUID from task export.
+// createTask creates a new task via ask add and returns its UUID.
+// ask add prints a human-facing created-task message, so we resolve the created UUID from task export.
func createTask(ctx context.Context, desc string) (string, error) {
- stdout, stderr, code := runDo(ctx, []string{"add", "+integrationtest", desc})
+ stdout, stderr, code := runAsk(ctx, []string{"add", "+integrationtest", desc})
if code != 0 {
return "", fmt.Errorf("create task failed (code %d): stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
id := extractTaskIDFromAddOutput(stdout.String())
if id == "" {
- return "", fmt.Errorf("could not extract task ID from do add output: %s", stdout.String())
+ return "", fmt.Errorf("could not extract task ID from ask add output: %s", stdout.String())
}
uuid, err := findTaskUUIDByDescription(ctx, desc)
if err != nil {
- return "", fmt.Errorf("could not resolve task UUID for %q after do add: %w", desc, err)
+ return "", fmt.Errorf("could not resolve task UUID for %q after ask add: %w", desc, err)
}
return uuid, nil
}
@@ -176,9 +176,9 @@ func TestProjectPrefixWorksOutsideGitRepo(t *testing.T) {
defer deleteTask(ctx, uuid)
outsideDir := t.TempDir()
- stdout, stderr, code := runDoInDir(ctx, outsideDir, []string{"proj:hexai", "list"})
+ stdout, stderr, code := runAskInDir(ctx, outsideDir, []string{"proj:hexai", "list"})
if code != 0 {
- t.Fatalf("do proj:hexai list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("ask proj:hexai list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
if !strings.Contains(stdout.String(), desc) {
t.Fatalf("output missing task description %q: %s", desc, stdout.String())
@@ -309,16 +309,16 @@ func parseTaskInfoText(output string, uuid string) taskInfo {
}
func getTaskInfoFast(ctx context.Context, uuid string) (taskInfo, bool) {
- stdout, _, code := runDo(ctx, []string{"info", uuid})
+ stdout, _, code := runAsk(ctx, []string{"info", uuid})
if code != 0 {
return taskInfo{}, false
}
return parseTaskInfoText(stdout.String(), uuid), true
}
-// getTaskInfoRaw returns the raw text output of do info for a given UUID.
+// getTaskInfoRaw returns the raw text output of ask info for a given UUID.
func getTaskInfoRaw(ctx context.Context, uuid string) (string, bool) {
- stdout, _, code := runDo(ctx, []string{"info", uuid})
+ stdout, _, code := runAsk(ctx, []string{"info", uuid})
if code != 0 {
return "", false
}
@@ -340,7 +340,7 @@ func mustTaskAlias(t *testing.T, ctx context.Context, uuid string) string {
func aliasCachePath(t *testing.T, cacheRoot string) string {
t.Helper()
- return filepath.Join(cacheRoot, "hexai", "do", "task-aliases-v2.json")
+ return filepath.Join(cacheRoot, "hexai", "ask", "task-aliases-v2.json")
}
// cleanupOrphanedIntegrationTasks deletes any tasks with the +integrationtest
@@ -374,11 +374,11 @@ func TestMain(m *testing.M) {
os.Exit(1)
}
// Always rebuild the binary so tests reflect the current source.
- doBin := doBinaryPath()
- cmd := exec.Command("go", "build", "-o", doBin, "./cmd/do/")
+ askBin := askBinaryPath()
+ cmd := exec.Command("go", "build", "-o", askBin, "./cmd/ask/")
cmd.Dir = repoRoot
if out, err := cmd.CombinedOutput(); err != nil {
- fmt.Fprintf(os.Stderr, "failed to build do binary: %v\n%s\n", err, out)
+ fmt.Fprintf(os.Stderr, "failed to build ask binary: %v\n%s\n", err, out)
os.Exit(1)
}
// Remove any tasks left over from previous integration test runs to avoid
@@ -410,14 +410,14 @@ func TestAdd(t *testing.T) {
}
}
-// TestAddReturnsAlias verifies that do add outputs the human-facing alias ID in its creation message.
+// TestAddReturnsAlias verifies that ask add outputs the human-facing alias ID in its creation message.
func TestAddReturnsAlias(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
- stdout, _, code := runDo(ctx, []string{"add", "+integrationtest", "uuid format check"})
+ stdout, _, code := runAsk(ctx, []string{"add", "+integrationtest", "uuid format check"})
if code != 0 {
- t.Fatalf("do add failed with code %d", code)
+ t.Fatalf("ask add failed with code %d", code)
}
rawOutput := strings.TrimSpace(stdout.String())
id := extractTaskIDFromAddOutput(rawOutput)
@@ -429,23 +429,23 @@ func TestAddReturnsAlias(t *testing.T) {
info, ok := getTaskInfoFast(ctx, uuid)
if !ok {
- t.Fatalf("do info %q failed after add", uuid)
+ t.Fatalf("ask info %q failed after add", uuid)
}
if id == "" {
- t.Fatal("do add returned an empty task ID")
+ t.Fatal("ask add returned an empty task ID")
}
if rawOutput != "created task "+id {
- t.Fatalf("do add output = %q, want %q", rawOutput, "created task "+id)
+ t.Fatalf("ask add output = %q, want %q", rawOutput, "created task "+id)
}
if uuidFormatRx.MatchString(id) {
- t.Fatalf("do add output %q leaked a UUID, want alias ID", id)
+ t.Fatalf("ask add output %q leaked a UUID, want alias ID", id)
}
if info.ID != id {
- t.Fatalf("do info ID = %q, want %q", info.ID, id)
+ t.Fatalf("ask info ID = %q, want %q", info.ID, id)
}
if info.UUID != uuid {
- t.Fatalf("do info UUID = %q, want %q", info.UUID, uuid)
+ t.Fatalf("ask info UUID = %q, want %q", info.UUID, uuid)
}
}
@@ -469,7 +469,7 @@ func TestAddWithDependsModifier(t *testing.T) {
dep1Alias := mustTaskAlias(t, ctx, dep1UUID)
dep2Alias := mustTaskAlias(t, ctx, dep2UUID)
- stdout, stderr, code := runDo(ctx, []string{
+ stdout, stderr, code := runAsk(ctx, []string{
"add",
"+integrationtest",
"depends:" + dep1Alias + "," + dep2Alias,
@@ -481,7 +481,7 @@ func TestAddWithDependsModifier(t *testing.T) {
"depends",
})
if code != 0 {
- t.Fatalf("do add with depends modifier failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("ask add with depends modifier failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
uuid, err := findTaskUUIDByDescription(ctx, "integration test task with inline depends")
@@ -511,7 +511,7 @@ func TestList(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"list"})
+ stdout, _, code := runAsk(ctx, []string{"list"})
if code != 0 {
t.Fatalf("list failed with code %d: %s", code, stdout.String())
}
@@ -537,7 +537,7 @@ func TestAll(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"all"})
+ stdout, _, code := runAsk(ctx, []string{"all"})
if code != 0 {
t.Fatalf("all failed with code %d: %s", code, stdout.String())
}
@@ -556,7 +556,7 @@ func TestReady(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"ready"})
+ stdout, _, code := runAsk(ctx, []string{"ready"})
if code != 0 {
t.Fatalf("ready failed with code %d: %s", code, stdout.String())
}
@@ -623,10 +623,10 @@ func TestInfoShowsAllDependencies(t *testing.T) {
}
defer deleteTask(ctx, dependent)
- if stdout, stderr, code := runDo(ctx, []string{"dep", "add", dependent, dependency2}); code != 0 {
+ if stdout, stderr, code := runAsk(ctx, []string{"dep", "add", dependent, dependency2}); code != 0 {
t.Fatalf("dep add for second dependency failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
- if stdout, stderr, code := runDo(ctx, []string{"dep", "add", dependent, dependency1}); code != 0 {
+ if stdout, stderr, code := runAsk(ctx, []string{"dep", "add", dependent, dependency1}); code != 0 {
t.Fatalf("dep add for first dependency failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
@@ -661,7 +661,7 @@ func TestAnnotate(t *testing.T) {
defer deleteTask(ctx, uuid)
note := "this is a test annotation"
- stdout, _, code := runDo(ctx, []string{"annotate", uuid, note})
+ stdout, _, code := runAsk(ctx, []string{"annotate", uuid, note})
if code != 0 {
t.Fatalf("annotate failed with code %d: %s", code, stdout.String())
}
@@ -685,7 +685,7 @@ func TestStart(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"start", uuid})
+ stdout, _, code := runAsk(ctx, []string{"start", uuid})
if code != 0 {
t.Fatalf("start failed with code %d: %s", code, stdout.String())
}
@@ -712,9 +712,9 @@ func TestStop(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- runDo(ctx, []string{"start", uuid})
+ runAsk(ctx, []string{"start", uuid})
- stdout, _, code := runDo(ctx, []string{"stop", uuid})
+ stdout, _, code := runAsk(ctx, []string{"stop", uuid})
if code != 0 {
t.Fatalf("stop failed with code %d: %s", code, stdout.String())
}
@@ -740,7 +740,7 @@ func TestDone(t *testing.T) {
t.Fatalf("failed to create task: %v", err)
}
- stdout, _, code := runDo(ctx, []string{"done", uuid})
+ stdout, _, code := runAsk(ctx, []string{"done", uuid})
if code != 0 {
t.Fatalf("done failed with code %d: %s", code, stdout.String())
}
@@ -766,7 +766,7 @@ func TestPriority(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"priority", uuid, "H"})
+ stdout, _, code := runAsk(ctx, []string{"priority", uuid, "H"})
if code != 0 {
t.Fatalf("priority failed with code %d: %s", code, stdout.String())
}
@@ -790,7 +790,7 @@ func TestTag(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"tag", uuid, "+cli"})
+ stdout, _, code := runAsk(ctx, []string{"tag", uuid, "+cli"})
if code != 0 {
t.Fatalf("tag add failed with code %d: %s", code, stdout.String())
}
@@ -810,7 +810,7 @@ func TestTag(t *testing.T) {
t.Errorf("tag cli not found on task: %+v", ti.Tags)
}
- runDo(ctx, []string{"tag", uuid, "-cli"})
+ runAsk(ctx, []string{"tag", uuid, "-cli"})
ti2, _ := getTaskInfoFast(ctx, uuid)
for _, tg := range ti2.Tags {
@@ -837,7 +837,7 @@ func TestDepAdd(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- stdout, _, code := runDo(ctx, []string{"dep", "add", uuid2, uuid1})
+ stdout, _, code := runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
if code != 0 {
t.Fatalf("dep add failed with code %d: %s", code, stdout.String())
}
@@ -877,9 +877,9 @@ func TestDepList(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- runDo(ctx, []string{"dep", "add", uuid2, uuid1})
+ runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
- stdout, _, code := runDo(ctx, []string{"dep", "list", uuid2})
+ stdout, _, code := runAsk(ctx, []string{"dep", "list", uuid2})
if code != 0 {
t.Fatalf("dep list failed with code %d: %s", code, stdout.String())
}
@@ -908,9 +908,9 @@ func TestDepRm(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- runDo(ctx, []string{"dep", "add", uuid2, uuid1})
+ runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
- stdout, _, code := runDo(ctx, []string{"dep", "rm", uuid2, uuid1})
+ stdout, _, code := runAsk(ctx, []string{"dep", "rm", uuid2, uuid1})
if code != 0 {
t.Fatalf("dep rm failed with code %d: %s", code, stdout.String())
}
@@ -939,7 +939,7 @@ func TestModify(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"modify", uuid, "priority:H"})
+ stdout, _, code := runAsk(ctx, []string{"modify", uuid, "priority:H"})
if code != 0 {
t.Fatalf("modify failed with code %d: %s", code, stdout.String())
}
@@ -964,7 +964,7 @@ func TestDenotate(t *testing.T) {
defer deleteTask(ctx, uuid)
note := "annotation to remove"
- runDo(ctx, []string{"annotate", uuid, note})
+ runAsk(ctx, []string{"annotate", uuid, note})
// Verify the annotation is present before denotating.
rawBefore, _ := getTaskInfoRaw(ctx, uuid)
@@ -972,7 +972,7 @@ func TestDenotate(t *testing.T) {
t.Fatalf("annotation %q not found before denotate", note)
}
- _, _, code := runDo(ctx, []string{"denotate", uuid, note})
+ _, _, code := runAsk(ctx, []string{"denotate", uuid, note})
if code != 0 {
t.Fatalf("denotate returned non-zero code: %d", code)
}
@@ -994,7 +994,7 @@ func TestDelete(t *testing.T) {
}
// delete forwards stdin to taskwarrior for confirmation.
- stdout, _, code := runDoWithStdin(ctx, []string{"delete", uuid}, "yes\n")
+ stdout, _, code := runAskWithStdin(ctx, []string{"delete", uuid}, "yes\n")
if code != 0 {
t.Fatalf("delete failed with code %d: %s", code, stdout.String())
}
@@ -1018,7 +1018,7 @@ func TestUrgency(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{"urgency"})
+ stdout, _, code := runAsk(ctx, []string{"urgency"})
if code != 0 {
t.Fatalf("urgency failed with code %d: %s", code, stdout.String())
}
@@ -1037,7 +1037,7 @@ func TestDefaultCommand(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runDo(ctx, []string{})
+ stdout, _, code := runAsk(ctx, []string{})
if code != 0 {
t.Fatalf("default command (list) failed with code %d: %s", code, stdout.String())
}
@@ -1050,7 +1050,7 @@ func TestHelp(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, _, code := runDo(ctx, []string{"help"})
+ stdout, _, code := runAsk(ctx, []string{"help"})
if code != 0 {
t.Fatalf("help returned non-zero exit code %d", code)
}
@@ -1066,13 +1066,13 @@ func TestFish(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, stderr, code := runDo(ctx, []string{"fish"})
+ stdout, stderr, code := runAsk(ctx, []string{"fish"})
if code != 0 {
t.Fatalf("fish returned non-zero exit code %d: stderr=%s", code, stderr.String())
}
out := stdout.String()
for _, fragment := range []string{
- "# Source with: do fish | source",
+ "# Source with: ask fish | source",
"complete -c",
"complete-uuids",
"annotate",
@@ -1091,14 +1091,14 @@ func TestFishRejectsExtraArgs(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, stderr, code := runDo(ctx, []string{"fish", "extra"})
+ stdout, stderr, code := runAsk(ctx, []string{"fish", "extra"})
if code == 0 {
t.Fatalf("expected non-zero exit code for fish extra args, got 0")
}
if stdout.Len() != 0 {
t.Errorf("fish with extra args wrote unexpected stdout: %s", stdout.String())
}
- if !strings.Contains(stderr.String(), "usage: do fish") {
+ if !strings.Contains(stderr.String(), "usage: ask fish") {
t.Errorf("fish with extra args stderr missing usage text: %s", stderr.String())
}
}
@@ -1114,7 +1114,7 @@ func TestCompleteUUIDs(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, stderr, code := runDo(ctx, []string{"complete-uuids"})
+ stdout, stderr, code := runAsk(ctx, []string{"complete-uuids"})
if code != 0 {
t.Fatalf("complete-uuids returned non-zero exit code %d: stderr=%s", code, stderr.String())
}
@@ -1150,7 +1150,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
}
note := "integration alias annotation"
- stdout, _, code := runDo(ctx, []string{"annotate", alias, note})
+ stdout, _, code := runAsk(ctx, []string{"annotate", alias, note})
if code != 0 {
t.Fatalf("annotate by alias failed with code %d: %s", code, stdout.String())
}
@@ -1164,10 +1164,10 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
}
note2 := "remove me via alias"
- if _, _, code = runDo(ctx, []string{"annotate", alias, note2}); code != 0 {
+ if _, _, code = runAsk(ctx, []string{"annotate", alias, note2}); code != 0 {
t.Fatalf("setup annotate for denotate failed with code %d", code)
}
- stdout, _, code = runDo(ctx, []string{"denotate", alias, note2})
+ stdout, _, code = runAsk(ctx, []string{"denotate", alias, note2})
if code != 0 {
t.Fatalf("denotate by alias failed with code %d: %s", code, stdout.String())
}
@@ -1176,7 +1176,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("annotation %q still present after alias denotate: %s", note2, raw)
}
- stdout, _, code = runDo(ctx, []string{"start", alias})
+ stdout, _, code = runAsk(ctx, []string{"start", alias})
if code != 0 {
t.Fatalf("start by alias failed with code %d: %s", code, stdout.String())
}
@@ -1185,7 +1185,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task not started after alias start: %+v", ti)
}
- stdout, _, code = runDo(ctx, []string{"stop", alias})
+ stdout, _, code = runAsk(ctx, []string{"stop", alias})
if code != 0 {
t.Fatalf("stop by alias failed with code %d: %s", code, stdout.String())
}
@@ -1194,7 +1194,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task not stopped after alias stop: %+v", ti)
}
- stdout, _, code = runDo(ctx, []string{"priority", alias, "H"})
+ stdout, _, code = runAsk(ctx, []string{"priority", alias, "H"})
if code != 0 {
t.Fatalf("priority by alias failed with code %d: %s", code, stdout.String())
}
@@ -1203,7 +1203,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task priority not updated after alias priority: %+v", ti)
}
- stdout, _, code = runDo(ctx, []string{"modify", alias, "priority:L"})
+ stdout, _, code = runAsk(ctx, []string{"modify", alias, "priority:L"})
if code != 0 {
t.Fatalf("modify by alias failed with code %d: %s", code, stdout.String())
}
@@ -1212,7 +1212,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task priority not updated after alias modify: %+v", ti)
}
- stdout, _, code = runDo(ctx, []string{"tag", alias, "+aliascheck"})
+ stdout, _, code = runAsk(ctx, []string{"tag", alias, "+aliascheck"})
if code != 0 {
t.Fatalf("tag by alias failed with code %d: %s", code, stdout.String())
}
@@ -1228,12 +1228,12 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
defer deleteTask(ctx, depUUID)
depAlias := mustTaskAlias(t, ctx, depUUID)
- stdout, _, code = runDo(ctx, []string{"dep", "add", alias, depAlias})
+ stdout, _, code = runAsk(ctx, []string{"dep", "add", alias, depAlias})
if code != 0 {
t.Fatalf("dep add by alias failed with code %d: %s", code, stdout.String())
}
- stdout, _, code = runDo(ctx, []string{"dep", "list", alias})
+ stdout, _, code = runAsk(ctx, []string{"dep", "list", alias})
if code != 0 {
t.Fatalf("dep list by alias failed with code %d: %s", code, stdout.String())
}
@@ -1241,11 +1241,11 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("dep list by alias output = %q, want alias %q without raw UUID", stdout.String(), depAlias)
}
- stdout, _, code = runDo(ctx, []string{"dep", "rm", alias, depAlias})
+ stdout, _, code = runAsk(ctx, []string{"dep", "rm", alias, depAlias})
if code != 0 {
t.Fatalf("dep rm by alias failed with code %d: %s", code, stdout.String())
}
- stdout, _, code = runDo(ctx, []string{"dep", "list", alias})
+ stdout, _, code = runAsk(ctx, []string{"dep", "list", alias})
if code != 0 {
t.Fatalf("dep list after rm failed with code %d: %s", code, stdout.String())
}
@@ -1258,7 +1258,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("failed to create done task: %v", err)
}
doneAlias := mustTaskAlias(t, ctx, doneUUID)
- stdout, _, code = runDo(ctx, []string{"done", doneAlias})
+ stdout, _, code = runAsk(ctx, []string{"done", doneAlias})
if code != 0 {
t.Fatalf("done by alias failed with code %d: %s", code, stdout.String())
}
@@ -1273,7 +1273,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("failed to create delete task: %v", err)
}
deleteAlias := mustTaskAlias(t, ctx, deleteUUID)
- stdout, _, code = runDoWithStdin(ctx, []string{"delete", deleteAlias}, "yes\n")
+ stdout, _, code = runAskWithStdin(ctx, []string{"delete", deleteAlias}, "yes\n")
if code != 0 {
t.Fatalf("delete by alias failed with code %d: %s", code, stdout.String())
}
@@ -1317,7 +1317,7 @@ func TestAliasCachePrunesExpiredEntriesOlderThan120Days(t *testing.T) {
t.Fatalf("WriteFile(%s): %v", cachePath, err)
}
- stdout, stderr, code := runDo(ctx, []string{"info", uuid})
+ stdout, stderr, code := runAsk(ctx, []string{"info", uuid})
if code != 0 {
t.Fatalf("info failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
@@ -1344,7 +1344,7 @@ func TestUnknownCommand(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- _, stderr, code := runDo(ctx, []string{"notacommand"})
+ _, stderr, code := runAsk(ctx, []string{"notacommand"})
if code == 0 {
t.Fatalf("expected non-zero exit code for unknown command, got 0")
}