42 lines
910 B
Go
42 lines
910 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/fatih/color"
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "grokkit",
|
|
Short: "Personal Grok / xAI command-line toolkit",
|
|
Long: `A fast, native Go CLI for Grok. Chat, edit files, and supercharge your git workflow.`,
|
|
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
|
viper.SetConfigName("config")
|
|
viper.SetConfigType("toml")
|
|
viper.AddConfigPath("$HOME/.config/grokkit")
|
|
viper.AddConfigPath(".")
|
|
viper.AutomaticEnv()
|
|
viper.ReadInConfig()
|
|
},
|
|
}
|
|
|
|
func Execute() {
|
|
if err := rootCmd.Execute(); err != nil {
|
|
color.Red("Error: %v", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(chatCmd)
|
|
rootCmd.AddCommand(editCmd)
|
|
rootCmd.AddCommand(reviewCmd)
|
|
rootCmd.AddCommand(commitMsgCmd)
|
|
rootCmd.AddCommand(commitCmd)
|
|
rootCmd.AddCommand(prDescribeCmd)
|
|
rootCmd.AddCommand(historyCmd)
|
|
}
|