get.go

 1// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
 2//
 3// SPDX-License-Identifier: AGPL-3.0-or-later
 4
 5package task
 6
 7import (
 8	"fmt"
 9
10	"git.secluded.site/lune/internal/validate"
11	"github.com/spf13/cobra"
12)
13
14// GetCmd retrieves a task by ID. Exported for potential use by shortcuts.
15var GetCmd = &cobra.Command{
16	Use:   "get ID",
17	Short: "Get a task by ID",
18	Args:  cobra.ExactArgs(1),
19	RunE: func(cmd *cobra.Command, args []string) error {
20		if err := validate.ID(args[0]); err != nil {
21			return err
22		}
23
24		// TODO: implement task get
25		fmt.Fprintf(cmd.OutOrStdout(), "Getting task %s (not yet implemented)\n", args[0])
26
27		return nil
28	},
29}
30
31func init() {
32	GetCmd.Flags().Bool("json", false, "Output as JSON")
33}