// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
//
// SPDX-License-Identifier: AGPL-3.0-or-later

package note

import (
	"fmt"

	"git.secluded.site/lune/internal/completion"
	"github.com/spf13/cobra"
)

// ListCmd lists notes. Exported for potential use by shortcuts.
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List notes",
	Long: `List notes from Lunatask.

Note: Due to end-to-end encryption, note names and content
are not available through the API. Only metadata is shown.`,
	RunE: func(cmd *cobra.Command, _ []string) error {
		// TODO: implement note listing
		fmt.Fprintln(cmd.OutOrStdout(), "Note listing not yet implemented")

		return nil
	},
}

func init() {
	ListCmd.Flags().StringP("notebook", "b", "", "Filter by notebook key")
	ListCmd.Flags().Bool("json", false, "Output as JSON")

	_ = ListCmd.RegisterFlagCompletionFunc("notebook", completion.Notebooks)
}
