Add plugins required flag (#40)

* add required plugins flag.

* update plugins logs.

* add plugins subcommand.

* move preflight to prerun.
This commit is contained in:
Miroslav Šedivý 2023-03-31 12:02:33 +02:00 committed by GitHub
parent 43a649d2c4
commit 1a752e43d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 197 additions and 85 deletions

View file

@ -24,14 +24,13 @@ func init() {
service := serve{}
command := &cobra.Command{
Use: "serve",
Short: "serve neko streaming server",
Long: `serve neko streaming server`,
Run: service.Command,
Use: "serve",
Short: "serve neko streaming server",
Long: `serve neko streaming server`,
PreRun: service.PreRun,
Run: service.Run,
}
cobra.OnInitialize(service.Preflight)
if err := service.Init(command); err != nil {
log.Panic().Err(err).Msg("unable to initialize configuration")
}
@ -91,7 +90,7 @@ func (c *serve) Init(cmd *cobra.Command) error {
return nil
}
func (c *serve) Preflight() {
func (c *serve) PreRun(cmd *cobra.Command, args []string) {
c.logger = log.With().Str("service", "neko").Logger()
c.configs.Desktop.Set()
@ -198,7 +197,7 @@ func (c *serve) Shutdown() {
c.logger.Err(err).Msg("member manager disconnect")
}
func (c *serve) Command(cmd *cobra.Command, args []string) {
func (c *serve) Run(cmd *cobra.Command, args []string) {
c.logger.Info().Msg("starting neko server")
c.Start(cmd)
c.logger.Info().Msg("neko ready")