28 lines
623 B
Go
28 lines
623 B
Go
package commands
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/cortezaproject/corteza/server/pkg/cli"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type (
|
|
serviceInitializer interface {
|
|
InitServices(ctx context.Context) error
|
|
Activate(ctx context.Context) error
|
|
}
|
|
)
|
|
|
|
func commandPreRunInitService(app serviceInitializer) func(*cobra.Command, []string) error {
|
|
return func(_ *cobra.Command, _ []string) error {
|
|
return app.InitServices(cli.Context())
|
|
}
|
|
}
|
|
|
|
func commandPreRunInitActivate(app serviceInitializer) func(*cobra.Command, []string) error {
|
|
return func(_ *cobra.Command, _ []string) error {
|
|
return app.Activate(cli.Context())
|
|
}
|
|
}
|