2019-12-04 17:15:11 +01:00
|
|
|
package command
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"os"
|
|
|
|
|
|
2022-05-04 14:49:59 +02:00
|
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/clihelper"
|
2021-03-10 12:26:14 +01:00
|
|
|
|
2021-09-14 16:05:03 +02:00
|
|
|
"github.com/urfave/cli/v2"
|
2024-08-04 13:04:52 +02:00
|
|
|
|
|
|
|
|
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
|
2019-12-04 17:15:11 +01:00
|
|
|
)
|
|
|
|
|
|
2022-01-03 13:53:27 +01:00
|
|
|
// GetCommands provides all commands for this service
|
|
|
|
|
func GetCommands(cfg *config.Config) cli.Commands {
|
2024-08-04 13:04:52 +02:00
|
|
|
return append([]*cli.Command{
|
2022-01-03 13:53:27 +01:00
|
|
|
// start this service
|
|
|
|
|
Server(cfg),
|
|
|
|
|
|
|
|
|
|
// interaction with this service
|
|
|
|
|
|
|
|
|
|
// infos about this service
|
|
|
|
|
Health(cfg),
|
|
|
|
|
Version(cfg),
|
2024-08-04 13:04:52 +02:00
|
|
|
}, UnifiedRoles(cfg)...)
|
2022-01-03 13:53:27 +01:00
|
|
|
}
|
|
|
|
|
|
2019-12-04 17:15:11 +01:00
|
|
|
// Execute is the entry point for the ocis-graph command.
|
2021-03-15 15:17:29 +00:00
|
|
|
func Execute(cfg *config.Config) error {
|
2022-01-03 13:53:27 +01:00
|
|
|
app := clihelper.DefaultApp(&cli.App{
|
2022-05-03 17:08:23 +02:00
|
|
|
Name: "graph",
|
2022-01-03 19:08:11 +01:00
|
|
|
Usage: "Serve Graph API for oCIS",
|
2022-01-03 13:53:27 +01:00
|
|
|
Commands: GetCommands(cfg),
|
|
|
|
|
})
|
2024-07-24 13:30:42 +02:00
|
|
|
return app.RunContext(cfg.Context, os.Args)
|
2019-12-04 17:15:11 +01:00
|
|
|
}
|