timeline.go

 1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
 2//
 3// SPDX-License-Identifier: AGPL-3.0-or-later
 4
 5package person
 6
 7import (
 8	"fmt"
 9
10	"git.secluded.site/lune/internal/validate"
11	"github.com/spf13/cobra"
12)
13
14// TimelineCmd adds a timeline note to a person. Exported for potential use by shortcuts.
15var TimelineCmd = &cobra.Command{
16	Use:   "timeline ID",
17	Short: "Add a timeline note to a person",
18	Long: `Add a timeline note to a person's memory timeline.
19
20Use "-" as content flag value to read from stdin.`,
21	Args: cobra.ExactArgs(1),
22	RunE: func(cmd *cobra.Command, args []string) error {
23		if err := validate.ID(args[0]); err != nil {
24			return err
25		}
26
27		// TODO: implement timeline note creation
28		fmt.Fprintf(cmd.OutOrStdout(), "Adding timeline note to person %s (not yet implemented)\n", args[0])
29
30		return nil
31	},
32}
33
34func init() {
35	TimelineCmd.Flags().StringP("content", "c", "", "Note content (use - for stdin)")
36	TimelineCmd.Flags().StringP("date", "d", "", "Date of interaction (natural language)")
37}