blasphem/cmd/blas/main.go
2022-12-20 13:16:30 -05:00

40 lines
735 B
Go

package main
import (
"os"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"dynatron.me/x/blasphem/internal/common"
"dynatron.me/x/blasphem/pkg/blas/core"
"dynatron.me/x/blasphem/pkg/cmd/serve"
"dynatron.me/x/blasphem/pkg/config"
"github.com/spf13/cobra"
)
func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
rootCmd := cobra.Command{
Use: common.AppName,
}
config, err := config.ReadConfig()
if err != nil {
log.Fatal().Err(err).Msg("Config read failed")
}
bl, err := core.New(config)
if err != nil {
log.Fatal().Err(err).Msg("Core create failed")
}
rootCmd.AddCommand(serve.Command(bl))
err = rootCmd.Execute()
if err != nil {
log.Fatal().Err(err).Msg("Dying")
}
}