migrate collaboration from urfave/cli to spf13/cobra

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2025-12-15 16:40:25 +01:00
committed by Florian Schade
parent f4526d4bc8
commit e6114853ea
5 changed files with 54 additions and 35 deletions
+10 -8
View File
@@ -5,12 +5,13 @@ import (
"github.com/opencloud-eu/opencloud/pkg/clihelper"
"github.com/opencloud-eu/opencloud/services/collaboration/pkg/config"
"github.com/urfave/cli/v2"
"github.com/spf13/cobra"
)
// GetCommands provides all commands for this service
func GetCommands(cfg *config.Config) cli.Commands {
return []*cli.Command{
func GetCommands(cfg *config.Config) []*cobra.Command {
return []*cobra.Command{
Server(cfg),
Health(cfg),
Version(cfg),
@@ -19,11 +20,12 @@ func GetCommands(cfg *config.Config) cli.Commands {
// Execute is the entry point for the antivirus command.
func Execute(cfg *config.Config) error {
app := clihelper.DefaultApp(&cli.App{
Name: "collaboration",
Usage: "Serve WOPI for OpenCloud",
Commands: GetCommands(cfg),
app := clihelper.DefaultAppCobra(&cobra.Command{
Use: "collaboration",
Short: "Serve WOPI for OpenCloud",
})
app.AddCommand(GetCommands(cfg)...)
app.SetArgs(os.Args[1:])
return app.RunContext(cfg.Context, os.Args)
return app.ExecuteContext(cfg.Context)
}