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",
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		id, err := validate.Reference(args[0])
24		if err != nil {
25			return err
26		}
27
28		// TODO: implement timeline note creation
29		fmt.Fprintf(cmd.OutOrStdout(), "Adding timeline note to person %s (not yet implemented)\n", id)
30
31		return nil
32	},
33}
34
35func init() {
36	TimelineCmd.Flags().StringP("content", "c", "", "Note content (use - for stdin)")
37	TimelineCmd.Flags().StringP("date", "d", "", "Date of interaction (natural language)")
38}