Files
opencloud/opencloud/pkg/command/root.go
André Duffeck 1fff27f281 Rebrand pkg
2025-01-20 09:34:32 +01:00

34 lines
719 B
Go

package command
import (
"context"
"os"
"os/signal"
"syscall"
"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"
)
// Execute is the entry point for the opencloud command.
func Execute() error {
cfg := config.DefaultConfig()
app := clihelper.DefaultApp(&cli.App{
Name: "opencloud",
Usage: "opencloud",
})
for _, fn := range register.Commands {
app.Commands = append(
app.Commands,
fn(cfg),
)
}
ctx, _ := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
return app.RunContext(ctx, os.Args)
}