summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-08 09:58:02 +0300
committerPaul Buetow <paul@buetow.org>2026-04-08 09:58:02 +0300
commit8e351c86502cea78f1f0b3aa19cde7ca702bacab (patch)
tree1340e27219255b0ebe49bdbe3b5c2fbd95df8810 /integrationtests
parent9e8f558a1f6fcdb09a8a02dfcd2e3d8fc9ce613f (diff)
Rename task CLI from ask to do
- Move cmd/ask to cmd/do; mage BuildDo builds binary named do - Update askcli help text, errors, Fish completion (complete -c do, __do_*) - Task alias cache path: XDG cache hexai/do/task-aliases-v2.json - Refresh README and docs; go install path cmd/do@latest - Remove accidentally tracked cmd/ask build artifact; ignore cmd/do/do and cmd/do/ask Made-with: Cursor
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/do_scope_test.go (renamed from integrationtests/ask_scope_test.go)54
-rw-r--r--integrationtests/do_test.go (renamed from integrationtests/ask_test.go)156
2 files changed, 105 insertions, 105 deletions
diff --git a/integrationtests/ask_scope_test.go b/integrationtests/do_scope_test.go
index a328881..f24f5ca 100644
--- a/integrationtests/ask_scope_test.go
+++ b/integrationtests/do_scope_test.go
@@ -13,7 +13,7 @@ import (
"codeberg.org/snonux/hexai/internal/askcli"
)
-func scopedAskArgs(scopePrefix string, args ...string) []string {
+func scopedDoArgs(scopePrefix string, args ...string) []string {
if strings.TrimSpace(scopePrefix) == "" {
return append([]string(nil), args...)
}
@@ -22,28 +22,28 @@ func scopedAskArgs(scopePrefix string, args ...string) []string {
}
func createTaskInScope(ctx context.Context, scopePrefix, desc string) (taskInfo, error) {
- stdout, stderr, code := runAsk(ctx, scopedAskArgs(scopePrefix, "add", "+integrationtest", desc))
+ stdout, stderr, code := runDo(ctx, scopedDoArgs(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 ask add output: %s", stdout.String())
+ return taskInfo{}, fmt.Errorf("could not extract task ID from do add output: %s", stdout.String())
}
info, ok := getTaskInfoInScope(ctx, scopePrefix, id)
if !ok {
- return taskInfo{}, fmt.Errorf("could not resolve task ID %q after ask %s add", id, scopePrefix)
+ return taskInfo{}, fmt.Errorf("could not resolve task ID %q after do %s add", id, scopePrefix)
}
if info.UUID == "" {
- return taskInfo{}, fmt.Errorf("ask %s info %q did not return a UUID", scopePrefix, id)
+ return taskInfo{}, fmt.Errorf("do %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 := runAsk(ctx, scopedAskArgs(scopePrefix, "info", selector))
+ stdout, _, code := runDo(ctx, scopedDoArgs(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 := runAsk(ctx, []string{"list"})
+ stdout, stderr, code := runDo(ctx, []string{"list"})
if code != 0 {
- t.Fatalf("ask list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("do list failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
if !strings.Contains(stdout.String(), agentDesc) {
- t.Fatalf("ask list should contain agent task %q: %s", agentDesc, stdout.String())
+ t.Fatalf("do list should contain agent task %q: %s", agentDesc, stdout.String())
}
if strings.Contains(stdout.String(), noAgentDesc) {
- t.Fatalf("ask list should not contain no-agent task %q: %s", noAgentDesc, stdout.String())
+ t.Fatalf("do 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 := runAsk(ctx, []string{prefix, "list"})
+ scopedStdout, scopedStderr, scopedCode := runDo(ctx, []string{prefix, "list"})
if scopedCode != 0 {
- t.Fatalf("ask %s list failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, scopedStdout.String(), scopedStderr.String())
+ t.Fatalf("do %s list failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, scopedStdout.String(), scopedStderr.String())
}
if !strings.Contains(scopedStdout.String(), noAgentDesc) {
- t.Fatalf("ask %s list should contain no-agent task %q: %s", prefix, noAgentDesc, scopedStdout.String())
+ t.Fatalf("do %s list should contain no-agent task %q: %s", prefix, noAgentDesc, scopedStdout.String())
}
if strings.Contains(scopedStdout.String(), agentDesc) {
- t.Fatalf("ask %s list should not contain agent task %q: %s", prefix, agentDesc, scopedStdout.String())
+ t.Fatalf("do %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 := runAsk(ctx, []string{"info", info.ID})
+ _, stderr, code := runDo(ctx, []string{"info", info.ID})
if code == 0 {
- t.Fatalf("ask info %s unexpectedly succeeded outside no-agent scope", info.ID)
+ t.Fatalf("do 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 := runAsk(ctx, []string{prefix, "info", info.ID})
+ stdout, scopedStderr, scopedCode := runDo(ctx, []string{prefix, "info", info.ID})
if scopedCode != 0 {
- t.Fatalf("ask %s info failed with code %d: stdout=%s stderr=%s", prefix, scopedCode, stdout.String(), scopedStderr.String())
+ t.Fatalf("do %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("ask %s info output missing UUID %q: %s", prefix, info.UUID, stdout.String())
+ t.Fatalf("do %s info output missing UUID %q: %s", prefix, info.UUID, stdout.String())
}
})
}
- stdout, stderr, code := runAsk(ctx, []string{"na", "done", info.ID})
+ stdout, stderr, code := runDo(ctx, []string{"na", "done", info.ID})
if code != 0 {
- t.Fatalf("ask na done failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("do 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 := runAsk(ctx, []string{"complete-uuids"})
+ defaultStdout, defaultStderr, defaultCode := runDo(ctx, []string{"complete-uuids"})
if defaultCode != 0 {
- t.Fatalf("ask complete-uuids failed with code %d: stdout=%s stderr=%s", defaultCode, defaultStdout.String(), defaultStderr.String())
+ t.Fatalf("do 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 := runAsk(ctx, []string{prefix, "complete-uuids"})
+ stdout, stderr, code := runDo(ctx, []string{prefix, "complete-uuids"})
if code != 0 {
- t.Fatalf("ask %s complete-uuids failed with code %d: stdout=%s stderr=%s", prefix, code, stdout.String(), stderr.String())
+ t.Fatalf("do %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("ask %s complete-uuids should contain no-agent selectors: %s", prefix, stdout.String())
+ t.Fatalf("do %s complete-uuids should contain no-agent selectors: %s", prefix, stdout.String())
}
if hasSelectorLine(stdout.String(), agentAlias) || hasSelectorLine(stdout.String(), agentUUID) {
- t.Fatalf("ask %s complete-uuids should not contain agent selectors: %s", prefix, stdout.String())
+ t.Fatalf("do %s complete-uuids should not contain agent selectors: %s", prefix, stdout.String())
}
})
}
diff --git a/integrationtests/ask_test.go b/integrationtests/do_test.go
index 0ebdb01..8462f3f 100644
--- a/integrationtests/ask_test.go
+++ b/integrationtests/do_test.go
@@ -44,12 +44,12 @@ func findRepoRoot() string {
return ""
}
-func askBinaryPath() string {
- return filepath.Join(repoRoot, "cmd", "ask", "ask")
+func doBinaryPath() string {
+ return filepath.Join(repoRoot, "cmd", "do", "do")
}
-func runAsk(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
- cmd := exec.CommandContext(ctx, askBinaryPath(), args...)
+func runDo(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, exitCode int) {
+ cmd := exec.CommandContext(ctx, doBinaryPath(), args...)
cmd.Dir = repoRoot
cmd.Stdout = &stdout
cmd.Stderr = &stderr
@@ -64,10 +64,10 @@ func runAsk(ctx context.Context, args []string) (stdout, stderr bytes.Buffer, ex
return stdout, stderr, ee.ExitCode()
}
-// runAskWithStdin runs ask with the given stdin. Only use this for commands
+// runDoWithStdin runs do with the given stdin. Only use this for commands
// that actually forward stdin to taskwarrior (currently only: delete).
-func runAskWithStdin(ctx context.Context, args []string, stdin string) (stdout, stderr bytes.Buffer, exitCode int) {
- cmd := exec.CommandContext(ctx, askBinaryPath(), args...)
+func runDoWithStdin(ctx context.Context, args []string, stdin string) (stdout, stderr bytes.Buffer, exitCode int) {
+ cmd := exec.CommandContext(ctx, doBinaryPath(), args...)
cmd.Dir = repoRoot
cmd.Stdin = strings.NewReader(stdin)
cmd.Stdout = &stdout
@@ -116,23 +116,23 @@ func runTaskWithStdin(ctx context.Context, args []string, stdin string) (stdout,
return stdout, stderr, ee.ExitCode()
}
-// 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 via ask info.
+// 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 via do info.
func createTask(ctx context.Context, desc string) (string, error) {
- stdout, stderr, code := runAsk(ctx, []string{"add", "+integrationtest", desc})
+ stdout, stderr, code := runDo(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 ask add output: %s", stdout.String())
+ return "", fmt.Errorf("could not extract task ID from do add output: %s", stdout.String())
}
info, ok := getTaskInfoFast(ctx, id)
if !ok {
- return "", fmt.Errorf("could not resolve task ID %q after ask add", id)
+ return "", fmt.Errorf("could not resolve task ID %q after do add", id)
}
if info.UUID == "" {
- return "", fmt.Errorf("ask info %q did not return a UUID", id)
+ return "", fmt.Errorf("do info %q did not return a UUID", id)
}
return info.UUID, nil
}
@@ -241,16 +241,16 @@ func parseTaskInfoText(output string, uuid string) taskInfo {
}
func getTaskInfoFast(ctx context.Context, uuid string) (taskInfo, bool) {
- stdout, _, code := runAsk(ctx, []string{"info", uuid})
+ stdout, _, code := runDo(ctx, []string{"info", uuid})
if code != 0 {
return taskInfo{}, false
}
return parseTaskInfoText(stdout.String(), uuid), true
}
-// getTaskInfoRaw returns the raw text output of ask info for a given UUID.
+// getTaskInfoRaw returns the raw text output of do info for a given UUID.
func getTaskInfoRaw(ctx context.Context, uuid string) (string, bool) {
- stdout, _, code := runAsk(ctx, []string{"info", uuid})
+ stdout, _, code := runDo(ctx, []string{"info", uuid})
if code != 0 {
return "", false
}
@@ -272,7 +272,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", "ask", "task-aliases-v2.json")
+ return filepath.Join(cacheRoot, "hexai", "do", "task-aliases-v2.json")
}
// cleanupOrphanedIntegrationTasks deletes any tasks with the +integrationtest
@@ -306,11 +306,11 @@ func TestMain(m *testing.M) {
os.Exit(1)
}
// Always rebuild the binary so tests reflect the current source.
- askBin := askBinaryPath()
- cmd := exec.Command("go", "build", "-o", askBin, "./cmd/ask/")
+ doBin := doBinaryPath()
+ cmd := exec.Command("go", "build", "-o", doBin, "./cmd/do/")
cmd.Dir = repoRoot
if out, err := cmd.CombinedOutput(); err != nil {
- fmt.Fprintf(os.Stderr, "failed to build ask binary: %v\n%s\n", err, out)
+ fmt.Fprintf(os.Stderr, "failed to build do binary: %v\n%s\n", err, out)
os.Exit(1)
}
// Remove any tasks left over from previous integration test runs to avoid
@@ -342,37 +342,37 @@ func TestAdd(t *testing.T) {
}
}
-// TestAddReturnsAlias verifies that ask add outputs the human-facing alias ID in its creation message.
+// TestAddReturnsAlias verifies that do 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 := runAsk(ctx, []string{"add", "+integrationtest", "uuid format check"})
+ stdout, _, code := runDo(ctx, []string{"add", "+integrationtest", "uuid format check"})
if code != 0 {
- t.Fatalf("ask add failed with code %d", code)
+ t.Fatalf("do add failed with code %d", code)
}
rawOutput := strings.TrimSpace(stdout.String())
id := extractTaskIDFromAddOutput(rawOutput)
info, ok := getTaskInfoFast(ctx, id)
if !ok {
- t.Fatalf("ask info %q failed after add", id)
+ t.Fatalf("do info %q failed after add", id)
}
defer deleteTask(ctx, info.UUID)
if id == "" {
- t.Fatal("ask add returned an empty task ID")
+ t.Fatal("do add returned an empty task ID")
}
if rawOutput != "created task "+id {
- t.Fatalf("ask add output = %q, want %q", rawOutput, "created task "+id)
+ t.Fatalf("do add output = %q, want %q", rawOutput, "created task "+id)
}
if uuidFormatRx.MatchString(id) {
- t.Fatalf("ask add output %q leaked a UUID, want alias ID", id)
+ t.Fatalf("do add output %q leaked a UUID, want alias ID", id)
}
if info.ID != id {
- t.Fatalf("ask info ID = %q, want %q", info.ID, id)
+ t.Fatalf("do info ID = %q, want %q", info.ID, id)
}
if !uuidFormatRx.MatchString(info.UUID) {
- t.Fatalf("ask info UUID = %q, want valid UUID", info.UUID)
+ t.Fatalf("do info UUID = %q, want valid UUID", info.UUID)
}
}
@@ -396,7 +396,7 @@ func TestAddWithDependsModifier(t *testing.T) {
dep1Alias := mustTaskAlias(t, ctx, dep1UUID)
dep2Alias := mustTaskAlias(t, ctx, dep2UUID)
- stdout, stderr, code := runAsk(ctx, []string{
+ stdout, stderr, code := runDo(ctx, []string{
"add",
"+integrationtest",
"depends:" + dep1Alias + "," + dep2Alias,
@@ -408,13 +408,13 @@ func TestAddWithDependsModifier(t *testing.T) {
"depends",
})
if code != 0 {
- t.Fatalf("ask add with depends modifier failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
+ t.Fatalf("do add with depends modifier failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
id := extractTaskIDFromAddOutput(stdout.String())
info, ok := getTaskInfoFast(ctx, id)
if !ok {
- t.Fatalf("ask info %q failed after add", id)
+ t.Fatalf("do info %q failed after add", id)
}
defer deleteTask(ctx, info.UUID)
@@ -439,7 +439,7 @@ func TestList(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"list"})
+ stdout, _, code := runDo(ctx, []string{"list"})
if code != 0 {
t.Fatalf("list failed with code %d: %s", code, stdout.String())
}
@@ -465,7 +465,7 @@ func TestAll(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"all"})
+ stdout, _, code := runDo(ctx, []string{"all"})
if code != 0 {
t.Fatalf("all failed with code %d: %s", code, stdout.String())
}
@@ -484,7 +484,7 @@ func TestReady(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"ready"})
+ stdout, _, code := runDo(ctx, []string{"ready"})
if code != 0 {
t.Fatalf("ready failed with code %d: %s", code, stdout.String())
}
@@ -553,10 +553,10 @@ func TestInfoShowsAllDependencies(t *testing.T) {
}
defer deleteTask(ctx, dependent)
- if stdout, stderr, code := runAsk(ctx, []string{"dep", "add", dependent, dependency2}); code != 0 {
+ if stdout, stderr, code := runDo(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 := runAsk(ctx, []string{"dep", "add", dependent, dependency1}); code != 0 {
+ if stdout, stderr, code := runDo(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())
}
@@ -591,7 +591,7 @@ func TestAnnotate(t *testing.T) {
defer deleteTask(ctx, uuid)
note := "this is a test annotation"
- stdout, _, code := runAsk(ctx, []string{"annotate", uuid, note})
+ stdout, _, code := runDo(ctx, []string{"annotate", uuid, note})
if code != 0 {
t.Fatalf("annotate failed with code %d: %s", code, stdout.String())
}
@@ -615,7 +615,7 @@ func TestStart(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"start", uuid})
+ stdout, _, code := runDo(ctx, []string{"start", uuid})
if code != 0 {
t.Fatalf("start failed with code %d: %s", code, stdout.String())
}
@@ -642,9 +642,9 @@ func TestStop(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- runAsk(ctx, []string{"start", uuid})
+ runDo(ctx, []string{"start", uuid})
- stdout, _, code := runAsk(ctx, []string{"stop", uuid})
+ stdout, _, code := runDo(ctx, []string{"stop", uuid})
if code != 0 {
t.Fatalf("stop failed with code %d: %s", code, stdout.String())
}
@@ -670,7 +670,7 @@ func TestDone(t *testing.T) {
t.Fatalf("failed to create task: %v", err)
}
- stdout, _, code := runAsk(ctx, []string{"done", uuid})
+ stdout, _, code := runDo(ctx, []string{"done", uuid})
if code != 0 {
t.Fatalf("done failed with code %d: %s", code, stdout.String())
}
@@ -696,7 +696,7 @@ func TestPriority(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"priority", uuid, "H"})
+ stdout, _, code := runDo(ctx, []string{"priority", uuid, "H"})
if code != 0 {
t.Fatalf("priority failed with code %d: %s", code, stdout.String())
}
@@ -720,7 +720,7 @@ func TestTag(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"tag", uuid, "+cli"})
+ stdout, _, code := runDo(ctx, []string{"tag", uuid, "+cli"})
if code != 0 {
t.Fatalf("tag add failed with code %d: %s", code, stdout.String())
}
@@ -740,7 +740,7 @@ func TestTag(t *testing.T) {
t.Errorf("tag cli not found on task: %+v", ti.Tags)
}
- runAsk(ctx, []string{"tag", uuid, "-cli"})
+ runDo(ctx, []string{"tag", uuid, "-cli"})
ti2, _ := getTaskInfoFast(ctx, uuid)
for _, tg := range ti2.Tags {
@@ -767,7 +767,7 @@ func TestDepAdd(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- stdout, _, code := runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
+ stdout, _, code := runDo(ctx, []string{"dep", "add", uuid2, uuid1})
if code != 0 {
t.Fatalf("dep add failed with code %d: %s", code, stdout.String())
}
@@ -807,9 +807,9 @@ func TestDepList(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
+ runDo(ctx, []string{"dep", "add", uuid2, uuid1})
- stdout, _, code := runAsk(ctx, []string{"dep", "list", uuid2})
+ stdout, _, code := runDo(ctx, []string{"dep", "list", uuid2})
if code != 0 {
t.Fatalf("dep list failed with code %d: %s", code, stdout.String())
}
@@ -838,9 +838,9 @@ func TestDepRm(t *testing.T) {
}
defer deleteTask(ctx, uuid2)
- runAsk(ctx, []string{"dep", "add", uuid2, uuid1})
+ runDo(ctx, []string{"dep", "add", uuid2, uuid1})
- stdout, _, code := runAsk(ctx, []string{"dep", "rm", uuid2, uuid1})
+ stdout, _, code := runDo(ctx, []string{"dep", "rm", uuid2, uuid1})
if code != 0 {
t.Fatalf("dep rm failed with code %d: %s", code, stdout.String())
}
@@ -869,7 +869,7 @@ func TestModify(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"modify", uuid, "priority:H"})
+ stdout, _, code := runDo(ctx, []string{"modify", uuid, "priority:H"})
if code != 0 {
t.Fatalf("modify failed with code %d: %s", code, stdout.String())
}
@@ -894,7 +894,7 @@ func TestDenotate(t *testing.T) {
defer deleteTask(ctx, uuid)
note := "annotation to remove"
- runAsk(ctx, []string{"annotate", uuid, note})
+ runDo(ctx, []string{"annotate", uuid, note})
// Verify the annotation is present before denotating.
rawBefore, _ := getTaskInfoRaw(ctx, uuid)
@@ -902,7 +902,7 @@ func TestDenotate(t *testing.T) {
t.Fatalf("annotation %q not found before denotate", note)
}
- _, _, code := runAsk(ctx, []string{"denotate", uuid, note})
+ _, _, code := runDo(ctx, []string{"denotate", uuid, note})
if code != 0 {
t.Fatalf("denotate returned non-zero code: %d", code)
}
@@ -924,7 +924,7 @@ func TestDelete(t *testing.T) {
}
// delete forwards stdin to taskwarrior for confirmation.
- stdout, _, code := runAskWithStdin(ctx, []string{"delete", uuid}, "yes\n")
+ stdout, _, code := runDoWithStdin(ctx, []string{"delete", uuid}, "yes\n")
if code != 0 {
t.Fatalf("delete failed with code %d: %s", code, stdout.String())
}
@@ -948,7 +948,7 @@ func TestUrgency(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{"urgency"})
+ stdout, _, code := runDo(ctx, []string{"urgency"})
if code != 0 {
t.Fatalf("urgency failed with code %d: %s", code, stdout.String())
}
@@ -967,7 +967,7 @@ func TestDefaultCommand(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, _, code := runAsk(ctx, []string{})
+ stdout, _, code := runDo(ctx, []string{})
if code != 0 {
t.Fatalf("default command (list) failed with code %d: %s", code, stdout.String())
}
@@ -980,7 +980,7 @@ func TestHelp(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, _, code := runAsk(ctx, []string{"help"})
+ stdout, _, code := runDo(ctx, []string{"help"})
if code != 0 {
t.Fatalf("help returned non-zero exit code %d", code)
}
@@ -996,13 +996,13 @@ func TestFish(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, stderr, code := runAsk(ctx, []string{"fish"})
+ stdout, stderr, code := runDo(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: ask fish | source",
+ "# Source with: do fish | source",
"complete -c",
"complete-uuids",
"annotate",
@@ -1021,14 +1021,14 @@ func TestFishRejectsExtraArgs(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- stdout, stderr, code := runAsk(ctx, []string{"fish", "extra"})
+ stdout, stderr, code := runDo(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: ask fish") {
+ if !strings.Contains(stderr.String(), "usage: do fish") {
t.Errorf("fish with extra args stderr missing usage text: %s", stderr.String())
}
}
@@ -1044,7 +1044,7 @@ func TestCompleteUUIDs(t *testing.T) {
}
defer deleteTask(ctx, uuid)
- stdout, stderr, code := runAsk(ctx, []string{"complete-uuids"})
+ stdout, stderr, code := runDo(ctx, []string{"complete-uuids"})
if code != 0 {
t.Fatalf("complete-uuids returned non-zero exit code %d: stderr=%s", code, stderr.String())
}
@@ -1079,7 +1079,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
}
note := "integration alias annotation"
- stdout, _, code := runAsk(ctx, []string{"annotate", alias, note})
+ stdout, _, code := runDo(ctx, []string{"annotate", alias, note})
if code != 0 {
t.Fatalf("annotate by alias failed with code %d: %s", code, stdout.String())
}
@@ -1093,10 +1093,10 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
}
note2 := "remove me via alias"
- if _, _, code = runAsk(ctx, []string{"annotate", alias, note2}); code != 0 {
+ if _, _, code = runDo(ctx, []string{"annotate", alias, note2}); code != 0 {
t.Fatalf("setup annotate for denotate failed with code %d", code)
}
- stdout, _, code = runAsk(ctx, []string{"denotate", alias, note2})
+ stdout, _, code = runDo(ctx, []string{"denotate", alias, note2})
if code != 0 {
t.Fatalf("denotate by alias failed with code %d: %s", code, stdout.String())
}
@@ -1105,7 +1105,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("annotation %q still present after alias denotate: %s", note2, raw)
}
- stdout, _, code = runAsk(ctx, []string{"start", alias})
+ stdout, _, code = runDo(ctx, []string{"start", alias})
if code != 0 {
t.Fatalf("start by alias failed with code %d: %s", code, stdout.String())
}
@@ -1114,7 +1114,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task not started after alias start: %+v", ti)
}
- stdout, _, code = runAsk(ctx, []string{"stop", alias})
+ stdout, _, code = runDo(ctx, []string{"stop", alias})
if code != 0 {
t.Fatalf("stop by alias failed with code %d: %s", code, stdout.String())
}
@@ -1123,7 +1123,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task not stopped after alias stop: %+v", ti)
}
- stdout, _, code = runAsk(ctx, []string{"priority", alias, "H"})
+ stdout, _, code = runDo(ctx, []string{"priority", alias, "H"})
if code != 0 {
t.Fatalf("priority by alias failed with code %d: %s", code, stdout.String())
}
@@ -1132,7 +1132,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task priority not updated after alias priority: %+v", ti)
}
- stdout, _, code = runAsk(ctx, []string{"modify", alias, "priority:L"})
+ stdout, _, code = runDo(ctx, []string{"modify", alias, "priority:L"})
if code != 0 {
t.Fatalf("modify by alias failed with code %d: %s", code, stdout.String())
}
@@ -1141,7 +1141,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("task priority not updated after alias modify: %+v", ti)
}
- stdout, _, code = runAsk(ctx, []string{"tag", alias, "+aliascheck"})
+ stdout, _, code = runDo(ctx, []string{"tag", alias, "+aliascheck"})
if code != 0 {
t.Fatalf("tag by alias failed with code %d: %s", code, stdout.String())
}
@@ -1157,12 +1157,12 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
defer deleteTask(ctx, depUUID)
depAlias := mustTaskAlias(t, ctx, depUUID)
- stdout, _, code = runAsk(ctx, []string{"dep", "add", alias, depAlias})
+ stdout, _, code = runDo(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 = runAsk(ctx, []string{"dep", "list", alias})
+ stdout, _, code = runDo(ctx, []string{"dep", "list", alias})
if code != 0 {
t.Fatalf("dep list by alias failed with code %d: %s", code, stdout.String())
}
@@ -1170,11 +1170,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 = runAsk(ctx, []string{"dep", "rm", alias, depAlias})
+ stdout, _, code = runDo(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 = runAsk(ctx, []string{"dep", "list", alias})
+ stdout, _, code = runDo(ctx, []string{"dep", "list", alias})
if code != 0 {
t.Fatalf("dep list after rm failed with code %d: %s", code, stdout.String())
}
@@ -1187,7 +1187,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("failed to create done task: %v", err)
}
doneAlias := mustTaskAlias(t, ctx, doneUUID)
- stdout, _, code = runAsk(ctx, []string{"done", doneAlias})
+ stdout, _, code = runDo(ctx, []string{"done", doneAlias})
if code != 0 {
t.Fatalf("done by alias failed with code %d: %s", code, stdout.String())
}
@@ -1202,7 +1202,7 @@ func TestAliasSelectorsAcrossUUIDCommands(t *testing.T) {
t.Fatalf("failed to create delete task: %v", err)
}
deleteAlias := mustTaskAlias(t, ctx, deleteUUID)
- stdout, _, code = runAskWithStdin(ctx, []string{"delete", deleteAlias}, "yes\n")
+ stdout, _, code = runDoWithStdin(ctx, []string{"delete", deleteAlias}, "yes\n")
if code != 0 {
t.Fatalf("delete by alias failed with code %d: %s", code, stdout.String())
}
@@ -1246,7 +1246,7 @@ func TestAliasCachePrunesExpiredEntriesOlderThan120Days(t *testing.T) {
t.Fatalf("WriteFile(%s): %v", cachePath, err)
}
- stdout, stderr, code := runAsk(ctx, []string{"info", uuid})
+ stdout, stderr, code := runDo(ctx, []string{"info", uuid})
if code != 0 {
t.Fatalf("info failed with code %d: stdout=%s stderr=%s", code, stdout.String(), stderr.String())
}
@@ -1273,7 +1273,7 @@ func TestUnknownCommand(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
- _, stderr, code := runAsk(ctx, []string{"notacommand"})
+ _, stderr, code := runDo(ctx, []string{"notacommand"})
if code == 0 {
t.Fatalf("expected non-zero exit code for unknown command, got 0")
}