add.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/completion"
11	"github.com/spf13/cobra"
12)
13
14// AddCmd creates a new person. Exported for potential use by shortcuts.
15var AddCmd = &cobra.Command{
16	Use:   "add FIRST LAST",
17	Short: "Add a new person",
18	Args:  cobra.ExactArgs(2),
19	RunE: func(cmd *cobra.Command, args []string) error {
20		// TODO: implement person creation
21		fmt.Fprintf(cmd.OutOrStdout(), "Adding person: %s %s (not yet implemented)\n", args[0], args[1])
22
23		return nil
24	},
25}
26
27func init() {
28	AddCmd.Flags().StringP("relationship", "r", "", "Relationship strength")
29
30	_ = AddCmd.RegisterFlagCompletionFunc("relationship", completion.Relationships)
31}