initial commit

This commit is contained in:
2026-01-01 21:46:20 +01:00
commit 26a46f92c1
11 changed files with 356 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
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)
}