feat: all six CLI commands (new, list, resume, open, info, archive)

Complete command implementations with all flags per spec. Shared query resolution helper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-05 18:34:40 -04:00
parent afd594ed6c
commit 50e7333e84
7 changed files with 401 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
package cmd
import (
"fmt"
"os"
"github.com/warrenronsiek/ctask/internal/workspace"
)
// resolveOne resolves a query to exactly one workspace. Prints errors and exits on 0 or >1 matches.
func resolveOne(root, query string, includeArchived bool) *workspace.QueryResult {
results, err := workspace.ResolveQuery(root, query, includeArchived)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
if len(results) == 0 {
fmt.Fprintf(os.Stderr, "No workspace matches %q.\n", query)
os.Exit(1)
}
if len(results) > 1 {
fmt.Fprintf(os.Stderr, "Multiple workspaces match %q:\n", query)
for _, r := range results {
fmt.Fprintf(os.Stderr, " %s\n", workspace.RelativePath(root, r.Path))
}
fmt.Fprintln(os.Stderr, "Specify a more precise query.")
os.Exit(1)
}
return &results[0]
}