refactor: urfave v2

This commit is contained in:
2024-07-09 13:18:49 +02:00
parent 04aec8232f
commit 375e17a4a0
103 changed files with 11135 additions and 183 deletions

View File

@ -17,13 +17,14 @@ import (
"coopcloud.tech/abra/pkg/secret"
"github.com/docker/docker/api/types"
dockerClient "github.com/docker/docker/client"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
var (
allSecrets bool
allSecretsFlag = &cli.BoolFlag{
Name: "all, a",
Name: "all",
Aliases: []string{"a"},
Destination: &allSecrets,
Usage: "Generate all secrets",
}
@ -32,7 +33,8 @@ var (
var (
rmAllSecrets bool
rmAllSecretsFlag = &cli.BoolFlag{
Name: "all, a",
Name: "all",
Aliases: []string{"a"},
Destination: &rmAllSecrets,
Usage: "Remove all secrets",
}
@ -59,7 +61,7 @@ var appSecretGenerateCommand = cli.Command{
log.Fatal(err)
}
if len(c.Args()) == 1 && !allSecrets {
if c.Args().Len() == 1 && !allSecrets {
err := errors.New("missing arguments <secret>/<version> or '--all'")
internal.ShowSubcommandHelpAndError(c, err)
}
@ -183,7 +185,7 @@ Example:
log.Fatal(err)
}
if len(c.Args()) != 4 {
if c.Args().Len() != 4 {
internal.ShowSubcommandHelpAndError(c, errors.New("missing arguments?"))
}
@ -419,10 +421,10 @@ var appSecretCommand = cli.Command{
Aliases: []string{"s"},
Usage: "Manage app secrets",
ArgsUsage: "<domain>",
Subcommands: []cli.Command{
appSecretGenerateCommand,
appSecretInsertCommand,
appSecretRmCommand,
appSecretLsCommand,
Subcommands: []*cli.Command{
&appSecretGenerateCommand,
&appSecretInsertCommand,
&appSecretRmCommand,
&appSecretLsCommand,
},
}