Files
gems/jade-depo/cmd/root.go
T
2026-01-01 21:46:20 +01:00

43 lines
785 B
Go

package cmd
import (
"fmt"
"os"
"git.jnss.me/joakim/jadedepo/internal/engine"
"github.com/spf13/cobra"
)
var (
rootCmd = &cobra.Command{
Short: "Jade CLI is a note-manager and orchestrator.",
}
)
var (
cfgPath string
depoPath string
)
func init() {
cobra.OnInitialize(func() {
if _, err := engine.Init(cfgPath, depoPath); err != nil {
fmt.Fprintf(os.Stderr, "Error initializing configuration: %v\n", err)
os.Exit(1)
}
})
rootCmd.PersistentFlags().StringVar(&cfgPath, "config", "", "Configuration path. Default $HOME/.config/jade")
rootCmd.PersistentFlags().StringVar(&depoPath, "depo", "", "Depository path. Default $HOME/jade-depository")
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}