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 init() {
20 rootCmd.AddCommand(pCmd)
21}
22
23func runPrintPlan(cmd *cobra.Command, args []string) error {
24 env, err := shared.Environment(cmd)
25 if err != nil {
26 return err
27 }
28
29 sessionDoc, found, err := shared.ActiveSession(cmd, env)
30 if err != nil {
31 return err
32 }
33 if !found {
34 return nil
35 }
36
37 _, err = shared.PrintPlan(cmd, env, sessionDoc.SID)
38 return err
39}