2024-07-14 13:47:48 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/rs/zerolog"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
|
|
|
|
"dynatron.me/x/stillbox/pkg/gordio"
|
2024-07-14 17:39:03 -04:00
|
|
|
"dynatron.me/x/stillbox/pkg/gordio/admin"
|
2024-07-14 13:47:48 -04:00
|
|
|
"dynatron.me/x/stillbox/pkg/gordio/config"
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
|
|
|
|
|
2024-07-23 20:27:19 -04:00
|
|
|
rootCmd := &cobra.Command{
|
2024-07-14 13:47:48 -04:00
|
|
|
Use: gordio.AppName,
|
|
|
|
}
|
2024-07-23 20:27:19 -04:00
|
|
|
cfg := config.New(rootCmd)
|
|
|
|
rootCmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
|
|
|
|
return cfg.ReadConfig()
|
2024-07-14 13:47:48 -04:00
|
|
|
}
|
|
|
|
|
2024-07-14 21:26:53 -04:00
|
|
|
cmds := append([]*cobra.Command{gordio.Command(cfg)}, admin.Command(cfg)...)
|
|
|
|
rootCmd.AddCommand(cmds...)
|
2024-07-14 13:47:48 -04:00
|
|
|
|
2024-07-23 20:27:19 -04:00
|
|
|
err := rootCmd.Execute()
|
2024-07-14 13:47:48 -04:00
|
|
|
if err != nil {
|
|
|
|
log.Fatal().Err(err).Msg("Dying")
|
|
|
|
}
|
|
|
|
}
|