list.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/completion"
11	"github.com/spf13/cobra"
12)
13
14// ListCmd lists tasks. Exported for potential use by shortcuts.
15var ListCmd = &cobra.Command{
16	Use:   "list",
17	Short: "List tasks",
18	Long: `List tasks from Lunatask.
19
20Note: Due to end-to-end encryption, task names and notes
21are not available through the API. Only metadata is shown.`,
22	RunE: func(cmd *cobra.Command, _ []string) error {
23		// TODO: implement task listing
24		fmt.Fprintln(cmd.OutOrStdout(), "Task listing not yet implemented")
25
26		return nil
27	},
28}
29
30func init() {
31	ListCmd.Flags().StringP("area", "a", "", "Filter by area key")
32	ListCmd.Flags().StringP("status", "s", "", "Filter by status")
33	ListCmd.Flags().Bool("json", false, "Output as JSON")
34
35	_ = ListCmd.RegisterFlagCompletionFunc("area", completion.Areas)
36	_ = ListCmd.RegisterFlagCompletionFunc("status",
37		completion.Static("later", "next", "started", "waiting", "completed"))
38}