Files
influx-cli/cmd/influx/ping.go
Daniel Moran 8e73906437 refactor: replace global slices with functions (#94)
I started to see strange behavior where flags would merge across
subcommands. I'm not sure if the bug was in our 'append' usage or
in urfave/cli's handling of flag-slices, but this change seems to
fix the problem either way.
2021-05-14 16:10:07 -04:00

24 lines
567 B
Go

package main
import (
"github.com/influxdata/influx-cli/v2/internal/cmd/ping"
"github.com/influxdata/influx-cli/v2/pkg/cli/middleware"
"github.com/urfave/cli/v2"
)
func newPingCmd() *cli.Command {
return &cli.Command{
Name: "ping",
Usage: "Check the InfluxDB /health endpoint",
Before: middleware.WithBeforeFns(withCli(), withApi(false)),
Flags: coreFlags(),
Action: func(ctx *cli.Context) error {
client := ping.Client{
CLI: getCLI(ctx),
HealthApi: getAPINoToken(ctx).HealthApi,
}
return client.Ping(ctx.Context)
},
}
}