fix: downgrade urfave/cli to v1 to enable more flexible parsing (#154)
This commit is contained in:
@ -3,66 +3,56 @@ package main
|
||||
import (
|
||||
"github.com/influxdata/influx-cli/v2/clients/setup"
|
||||
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func newSetupCmd() *cli.Command {
|
||||
func newSetupCmd() cli.Command {
|
||||
var params setup.Params
|
||||
return &cli.Command{
|
||||
return cli.Command{
|
||||
Name: "setup",
|
||||
Usage: "Setup instance with initial user, org, bucket",
|
||||
Before: middleware.WithBeforeFns(withCli(), withApi(false)),
|
||||
Flags: append(
|
||||
commonFlagsNoToken(),
|
||||
&cli.StringFlag{
|
||||
Name: "username",
|
||||
Name: "username, u",
|
||||
Usage: "Name of initial user to create",
|
||||
Aliases: []string{"u"},
|
||||
Destination: ¶ms.Username,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "password",
|
||||
Name: "password, p",
|
||||
Usage: "Password to set on initial user",
|
||||
Aliases: []string{"p"},
|
||||
Destination: ¶ms.Password,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: tokenFlagName,
|
||||
Name: tokenFlagName + ", t",
|
||||
Usage: "Auth token to set on the initial user",
|
||||
Aliases: []string{"t"},
|
||||
EnvVars: []string{"INFLUX_TOKEN"},
|
||||
DefaultText: "auto-generated",
|
||||
EnvVar: "INFLUX_TOKEN",
|
||||
Destination: ¶ms.AuthToken,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "org",
|
||||
Name: "org, o",
|
||||
Usage: "Name of initial organization to create",
|
||||
Aliases: []string{"o"},
|
||||
Destination: ¶ms.Org,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "bucket",
|
||||
Name: "bucket, b",
|
||||
Usage: "Name of initial bucket to create",
|
||||
Aliases: []string{"b"},
|
||||
Destination: ¶ms.Bucket,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "retention",
|
||||
Name: "retention, r",
|
||||
Usage: "Duration initial bucket will retain data, or 0 for infinite",
|
||||
Aliases: []string{"r"},
|
||||
DefaultText: "infinite",
|
||||
Destination: ¶ms.Retention,
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "force",
|
||||
Name: "force, f",
|
||||
Usage: "Skip confirmation prompt",
|
||||
Aliases: []string{"f"},
|
||||
Destination: ¶ms.Force,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "name",
|
||||
Name: "name, n",
|
||||
Usage: "Name to set on CLI config generated for the InfluxDB instance, required if other configs exist",
|
||||
Aliases: []string{"n"},
|
||||
Destination: ¶ms.ConfigName,
|
||||
},
|
||||
),
|
||||
@ -71,7 +61,7 @@ func newSetupCmd() *cli.Command {
|
||||
CLI: getCLI(ctx),
|
||||
SetupApi: getAPINoToken(ctx).SetupApi,
|
||||
}
|
||||
return client.Setup(ctx.Context, ¶ms)
|
||||
return client.Setup(getContext(ctx), ¶ms)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user