migrate auth-bearer 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
8dc3877314
commit
af4c0b8d0c
@@ -7,13 +7,14 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/pkg/clihelper"
|
||||
occfg "github.com/opencloud-eu/opencloud/pkg/config"
|
||||
"github.com/opencloud-eu/opencloud/services/auth-bearer/pkg/config"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/thejerf/suture/v4"
|
||||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// 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),
|
||||
|
||||
@@ -27,13 +28,14 @@ func GetCommands(cfg *config.Config) cli.Commands {
|
||||
|
||||
// Execute is the entry point for the opencloud auth-bearer command.
|
||||
func Execute(cfg *config.Config) error {
|
||||
app := clihelper.DefaultApp(&cli.App{
|
||||
Name: "auth-bearer",
|
||||
Usage: "Provide bearer authentication for OpenCloud",
|
||||
Commands: GetCommands(cfg),
|
||||
app := clihelper.DefaultAppCobra(&cobra.Command{
|
||||
Use: "auth-bearer",
|
||||
Short: "Provide bearer authentication for OpenCloud",
|
||||
})
|
||||
app.AddCommand(GetCommands(cfg)...)
|
||||
app.SetArgs(os.Args[1:])
|
||||
|
||||
return app.RunContext(cfg.Context, os.Args)
|
||||
return app.ExecuteContext(cfg.Context)
|
||||
}
|
||||
|
||||
// SutureService allows for the accounts command to be embedded and supervised by a suture supervisor tree.
|
||||
|
||||
Reference in New Issue
Block a user