fix: downgrade urfave/cli to v1 to enable more flexible parsing (#154)
This commit is contained in:
@ -3,40 +3,39 @@ package main
|
||||
import (
|
||||
"github.com/influxdata/influx-cli/v2/clients/delete"
|
||||
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
|
||||
"github.com/urfave/cli/v2"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
func newDeleteCmd() *cli.Command {
|
||||
func newDeleteCmd() cli.Command {
|
||||
var params delete.Params
|
||||
return &cli.Command{
|
||||
return cli.Command{
|
||||
Name: "delete",
|
||||
Usage: "Delete points from InfluxDB",
|
||||
Description: "Delete points from InfluxDB, by specify start, end time and a sql like predicate string",
|
||||
Flags: append(
|
||||
commonFlagsNoPrint(),
|
||||
&cli.GenericFlag{
|
||||
Name: "org-id",
|
||||
Usage: "The ID of the organization that owns the bucket",
|
||||
EnvVars: []string{"INFLUX_ORG_ID"},
|
||||
Value: ¶ms.OrgID,
|
||||
Name: "org-id",
|
||||
Usage: "The ID of the organization that owns the bucket",
|
||||
EnvVar: "INFLUX_ORG_ID",
|
||||
Value: ¶ms.OrgID,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "org",
|
||||
Name: "org, o",
|
||||
Usage: "The name of the organization that owns the bucket",
|
||||
Aliases: []string{"o"},
|
||||
EnvVars: []string{"INFLUX_ORG"},
|
||||
EnvVar: "INFLUX_ORG",
|
||||
Destination: ¶ms.OrgName,
|
||||
},
|
||||
&cli.GenericFlag{
|
||||
Name: "bucket-id",
|
||||
Usage: "The ID of the bucket to delete from",
|
||||
EnvVars: []string{"INFLUX_BUCKET_ID"},
|
||||
Value: ¶ms.BucketID,
|
||||
Name: "bucket-id",
|
||||
Usage: "The ID of the bucket to delete from",
|
||||
EnvVar: "INFLUX_BUCKET_ID",
|
||||
Value: ¶ms.BucketID,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "bucket",
|
||||
Usage: "The name of the bucket to delete from",
|
||||
EnvVars: []string{"INFLUX_BUCKET_NAME"},
|
||||
EnvVar: "INFLUX_BUCKET_NAME",
|
||||
Destination: ¶ms.BucketName,
|
||||
},
|
||||
// NOTE: cli has a Timestamp flag we could use to parse the strings immediately on input,
|
||||
@ -54,16 +53,15 @@ func newDeleteCmd() *cli.Command {
|
||||
Destination: ¶ms.Stop,
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "predicate",
|
||||
Name: "predicate, p",
|
||||
Usage: "sql like predicate string (ex: 'tag1=\"v1\" and (tag2=123)')",
|
||||
Aliases: []string{"p"},
|
||||
Destination: ¶ms.Predicate,
|
||||
},
|
||||
),
|
||||
Before: middleware.WithBeforeFns(withCli(), withApi(true)),
|
||||
Action: func(ctx *cli.Context) error {
|
||||
client := delete.Client{CLI: getCLI(ctx), DeleteApi: getAPI(ctx).DeleteApi}
|
||||
return client.Delete(ctx.Context, ¶ms)
|
||||
return client.Delete(getContext(ctx), ¶ms)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user