/* Copyright © 2026 Hector Alfaro */ package cmd import ( "os" "github.com/joho/godotenv" "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{ Use: "books", Short: "Manage book and status data for atproto lexicon records", PersistentPreRunE: func(cmd *cobra.Command, args []string) error { // fallbacks for env variables godotenv.Load() store, _ := cmd.Root().PersistentFlags().GetString("store") if store == "" { cmd.Root().PersistentFlags().Set("store", os.Getenv("STORE_PATH")) } return nil }, } func Execute() { err := rootCmd.Execute() if err != nil { os.Exit(1) } } func init() { os.UserHomeDir() // we set default path at runtime rootCmd.PersistentFlags().String("store", "", "Path to the local book storage") }