feat(v0.3): add Projects filter to ListWorkspaces; fix last/delete
ListOpts gains a Projects bool that filters by EffectiveType. Default behavior (Projects: false) now returns tasks only -- this is a deliberate semantic change that supports the new 'ctask list' (tasks) vs 'ctask list --projects' (projects) spec. The change silently regresses two cmd-level callers that scan for "the most recently updated workspace": cmd/last.go (used by 'ctask last') and cmd/delete.go (used to print the "this was your most recent workspace" note). Both are fixed by unioning a tasks-scan with a projects-scan, so 'last' and 'delete' continue to consider both types. Test helper createTestWorkspaceTyped allows setting an explicit type (or "" to simulate a v0.2 workspace with no type field).
This commit is contained in:
+9
-2
@@ -70,11 +70,18 @@ func runDelete(cmd *cobra.Command, args []string) error {
|
||||
fmt.Printf(" Workspace: %s\n", relPath)
|
||||
fmt.Printf(" Files: %d (%s)\n", fileCount, formatSize(totalSize))
|
||||
|
||||
// Check if this is the most recently updated workspace
|
||||
results, _ := workspace.ListWorkspaces(root, workspace.ListOpts{
|
||||
// Check if this is the most recently updated workspace.
|
||||
// v0.3: union tasks and projects so the "most recent" check spans both types.
|
||||
tasks, _ := workspace.ListWorkspaces(root, workspace.ListOpts{
|
||||
IncludeArchived: false,
|
||||
Limit: 0,
|
||||
})
|
||||
projects, _ := workspace.ListWorkspaces(root, workspace.ListOpts{
|
||||
IncludeArchived: false,
|
||||
Projects: true,
|
||||
Limit: 0,
|
||||
})
|
||||
results := append(tasks, projects...)
|
||||
if len(results) > 0 {
|
||||
best := results[0]
|
||||
for _, r := range results[1:] {
|
||||
|
||||
Reference in New Issue
Block a user