migrate postprocessing from urfave/cli to spf13/cobra

Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
Christian Richter
2025-12-02 15:42:06 +01:00
committed by Florian Schade
parent 131178e5d9
commit b76d4fc661
5 changed files with 66 additions and 61 deletions

View File

@@ -5,12 +5,13 @@ import (
"github.com/opencloud-eu/opencloud/pkg/clihelper"
"github.com/opencloud-eu/opencloud/services/postprocessing/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{
// start this service
Server(cfg),
@@ -25,11 +26,12 @@ func GetCommands(cfg *config.Config) cli.Commands {
// Execute is the entry point for the postprocessing command.
func Execute(cfg *config.Config) error {
app := clihelper.DefaultApp(&cli.App{
Name: "postprocessing",
Usage: "starts postprocessing service",
Commands: GetCommands(cfg),
app := clihelper.DefaultAppCobra(&cobra.Command{
Use: "postprocessing",
Short: "starts postprocessing service",
})
app.AddCommand(GetCommands(cfg)...)
app.SetArgs(os.Args[1:])
return app.RunContext(cfg.Context, os.Args)
return app.ExecuteContext(cfg.Context)
}