stillbox/cmd/gordio/main.go
2024-07-14 17:39:03 -04:00

36 lines
667 B
Go

package main
import (
"os"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"dynatron.me/x/stillbox/pkg/gordio"
"dynatron.me/x/stillbox/pkg/gordio/admin"
"dynatron.me/x/stillbox/pkg/gordio/config"
"github.com/spf13/cobra"
)
func main() {
log.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})
rootCmd := cobra.Command{
Use: gordio.AppName,
}
cfg, err := config.ReadConfig()
if err != nil {
log.Fatal().Err(err).Msg("Config read failed")
}
cmds := []*cobra.Command{gordio.Command(cfg)}
rootCmd.AddCommand(append(cmds, admin.Command(cfg)...)...)
err = rootCmd.Execute()
if err != nil {
log.Fatal().Err(err).Msg("Dying")
}
}