package serve import ( "dynatron.me/x/blasphem/internal/common" "dynatron.me/x/blasphem/pkg/blas" "dynatron.me/x/blasphem/pkg/server" "github.com/spf13/cobra" ) type ServeOptions struct { core blas.Core } func Command(core blas.Core) *cobra.Command { opts := makeOptions(core) serveCmd := &cobra.Command{ Use: "serve", Short: "starts the " + common.AppName + " server", RunE: common.RunE(opts), } return serveCmd } func makeOptions(core blas.Core) *ServeOptions { return &ServeOptions{ core: core, } } func (o *ServeOptions) Options(_ *cobra.Command, args []string) error { return nil } func (o *ServeOptions) Execute() error { server, err := server.New(o.core) if err != nil { return err } err = server.Go() if err != nil { return err } return nil }