mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-02-05 19:48:59 -06:00
migrate oc root cli command from urfave/cli to spf13/cobra
Signed-off-by: Christian Richter <c.richter@opencloud.eu>
This commit is contained in:
committed by
Florian Schade
parent
7c2eb19050
commit
d89054484d
@@ -9,25 +9,23 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/opencloud/pkg/register"
|
||||
"github.com/opencloud-eu/opencloud/pkg/clihelper"
|
||||
"github.com/opencloud-eu/opencloud/pkg/config"
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// Execute is the entry point for the opencloud command.
|
||||
func Execute() error {
|
||||
cfg := config.DefaultConfig()
|
||||
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "opencloud",
|
||||
Usage: "opencloud",
|
||||
app := clihelper.DefaultAppCobra(&cobra.Command{
|
||||
Use: "opencloud",
|
||||
Short: "opencloud",
|
||||
})
|
||||
|
||||
for _, fn := range register.Commands {
|
||||
app.Commands = append(
|
||||
app.Commands,
|
||||
fn(cfg),
|
||||
)
|
||||
app.AddCommand(fn(cfg))
|
||||
}
|
||||
|
||||
app.SetArgs(os.Args[1:])
|
||||
ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
|
||||
return app.RunContext(ctx, os.Args)
|
||||
return app.ExecuteContext(ctx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user