-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommand_plan_inspect.go
More file actions
41 lines (33 loc) · 1009 Bytes
/
command_plan_inspect.go
File metadata and controls
41 lines (33 loc) · 1009 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package tasked
import (
"fmt"
"github.com/dhamidi/tasked/planner"
"github.com/spf13/cobra"
)
var PlanInspectCmd = &cobra.Command{
Use: "inspect <plan-name>",
Short: "Display detailed plan information",
Long: `Display detailed information about a plan including all its steps, their status,
and acceptance criteria. This provides a comprehensive view of the plan's current state.`,
Args: cobra.ExactArgs(1),
RunE: RunPlanInspect,
}
func RunPlanInspect(cmd *cobra.Command, args []string) error {
planName := args[0]
// Get the database file path from settings
dbPath := GlobalSettings.GetDatabaseFile()
// Initialize the planner
p, err := planner.New(dbPath)
if err != nil {
return fmt.Errorf("failed to initialize planner: %w", err)
}
defer p.Close()
// Get the plan from the database
plan, err := p.Get(planName)
if err != nil {
return fmt.Errorf("failed to get plan: %w", err)
}
// Display the plan details using the Inspect method
fmt.Print(plan.Inspect())
return nil
}