Something went wrong. Try again.
A delightful CLI for Lunatask.app
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394// SPDX-FileCopyrightText: Amolith <amolith@secluded.site>//// SPDX-License-Identifier: AGPL-3.0-or-later
// Package cmd provides the lune CLI commands.package cmd
import ( "context" "os"
"github.com/charmbracelet/fang" "github.com/spf13/cobra"
"secluded.site/lune/cmd/area" "secluded.site/lune/cmd/goal" "secluded.site/lune/cmd/habit" initcmd "secluded.site/lune/cmd/init" "secluded.site/lune/cmd/journal" "secluded.site/lune/cmd/mcp" "secluded.site/lune/cmd/note" "secluded.site/lune/cmd/person" "secluded.site/lune/cmd/task" "secluded.site/lune/internal/config" "secluded.site/lune/internal/ui")
var ( version = "dev" commit = "none")
const shortcutsGroupID = "shortcuts"
var rootCmd = &cobra.Command{ Use: "lune", Short: "A delightful CLI for Lunatask", Long: `lune is a command-line interface for Lunatask, the encryptedall-in-one productivity app for tasks, habits, journaling, and more.
Run 'lune init' to configure your access token and get started.`, SilenceUsage: true, SilenceErrors: true, PersistentPreRun: func(_ *cobra.Command, _ []string) { cfg, err := config.Load() if err != nil { return }
switch cfg.UI.Color { case "always": ui.SetColorMode(ui.ColorAlways) case "never": ui.SetColorMode(ui.ColorNever) default: ui.SetColorMode(ui.ColorAuto) } },}
func init() { rootCmd.AddGroup(&cobra.Group{ID: "resources", Title: "Resources"}) rootCmd.AddGroup(&cobra.Group{ID: shortcutsGroupID, Title: "Shortcuts"})
rootCmd.AddCommand(initcmd.Cmd) rootCmd.AddCommand(pingCmd) rootCmd.AddCommand(mcp.Cmd)
rootCmd.AddCommand(area.Cmd) rootCmd.AddCommand(goal.Cmd) rootCmd.AddCommand(task.Cmd) rootCmd.AddCommand(note.Cmd) rootCmd.AddCommand(person.Cmd) rootCmd.AddCommand(journal.Cmd) rootCmd.AddCommand(habit.Cmd)
rootCmd.AddCommand(addCmd) rootCmd.AddCommand(doneCmd) rootCmd.AddCommand(jrnlCmd)}
// Execute runs the root command with Fang styling.func Execute(ctx context.Context, v string) error { version = v
return fang.Execute( ctx, rootCmd, fang.WithVersion(version), fang.WithCommit(commit), fang.WithNotifySignal(os.Interrupt), )}