Files
ocis/pkg/command/graph-explorer.go
T

43 lines
1.2 KiB
Go
Raw Normal View History

2020-01-23 13:59:06 +01:00
// +build !simple
package command
import (
2020-02-10 17:04:40 +01:00
"github.com/micro/cli/v2"
2020-01-23 13:59:06 +01:00
"github.com/owncloud/ocis-graph-explorer/pkg/command"
svcconfig "github.com/owncloud/ocis-graph-explorer/pkg/config"
"github.com/owncloud/ocis-graph-explorer/pkg/flagset"
"github.com/owncloud/ocis/pkg/config"
"github.com/owncloud/ocis/pkg/register"
)
// GraphExplorerCommand is the entry point for the graph command.
2020-02-10 17:04:40 +01:00
func GraphExplorerCommand(cfg *config.Config) *cli.Command {
return &cli.Command{
2020-01-23 13:59:06 +01:00
Name: "graph-explorer",
Usage: "Start graph explorer",
Category: "Extensions",
Flags: flagset.ServerWithConfig(cfg.GraphExplorer),
2020-03-17 15:01:09 +01:00
Action: func(ctx *cli.Context) error {
graphExplorerCommand := command.Server(configureGraphExplorer(cfg))
2020-01-23 13:59:06 +01:00
2020-03-17 15:01:09 +01:00
if err := graphExplorerCommand.Before(ctx); err != nil {
return err
}
return cli.HandleAction(graphExplorerCommand.Action, ctx)
2020-01-23 13:59:06 +01:00
},
}
}
func configureGraphExplorer(cfg *config.Config) *svcconfig.Config {
cfg.GraphExplorer.Log.Level = cfg.Log.Level
cfg.GraphExplorer.Log.Pretty = cfg.Log.Pretty
cfg.GraphExplorer.Log.Color = cfg.Log.Color
return cfg.GraphExplorer
}
func init() {
register.AddCommand(GraphExplorerCommand)
}