1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
2//
3// SPDX-License-Identifier: AGPL-3.0-or-later
4
5package cmd
6
7import (
8 "git.secluded.site/np/cmd/shared"
9 "github.com/spf13/cobra"
10)
11
12var pCmd = &cobra.Command{
13 Use: "p",
14 Short: "Check plan",
15 Long: `Display the current session plan (goal, description, remaining tasks)`,
16 RunE: runPrintPlan,
17}
18
19func runPrintPlan(cmd *cobra.Command, args []string) error {
20 env, err := shared.Environment(cmd)
21 if err != nil {
22 return err
23 }
24
25 sessionDoc, found, err := shared.ActiveSession(cmd, env)
26 if err != nil {
27 return err
28 }
29 if !found {
30 return nil
31 }
32
33 _, err = shared.PrintPlan(cmd, env, sessionDoc.SID)
34 return err
35}