neko/server/cmd/root.go

37 lines
672 B
Go
Raw Normal View History

2020-01-13 21:05:38 +13:00
package cmd
import (
"fmt"
2020-01-19 12:30:09 +13:00
"github.com/rs/zerolog/log"
"github.com/spf13/cobra"
2020-01-13 21:05:38 +13:00
"n.eko.moe/neko"
"n.eko.moe/neko/internal/preflight"
)
func Execute() error {
return root.Execute()
}
var root = &cobra.Command{
Use: "neko",
2020-01-19 12:30:09 +13:00
Short: "neko streaming server",
Long: `neko streaming server`,
2020-01-13 21:05:38 +13:00
Version: neko.Service.Version.String(),
}
func init() {
cobra.OnInitialize(func() {
preflight.Logs("neko")
preflight.Config("neko")
neko.Service.Root.Set()
})
if err := neko.Service.Root.Init(root); err != nil {
2020-01-19 12:30:09 +13:00
log.Panic().Err(err).Msg("unable to run root command")
2020-01-13 21:05:38 +13:00
}
2020-01-19 12:30:09 +13:00
root.SetVersionTemplate(fmt.Sprintf("version: %s\n", neko.Service.Version))
2020-01-13 21:05:38 +13:00
}