chore(influx): make runE middleware application explicit from caller

pull/17206/head
Johnny Steenbergen 2020-03-25 11:54:49 -07:00 committed by Johnny Steenbergen
parent 7d8bd1e055
commit 36d99bfbf8
19 changed files with 83 additions and 76 deletions

View File

@ -11,7 +11,7 @@ import (
)
func cmdAuth(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("auth", nil)
cmd := opt.newCmd("auth", nil, false)
cmd.Aliases = []string{"authorization"}
cmd.Short = "Authorization management commands"
cmd.Run = seeHelp

View File

@ -10,12 +10,11 @@ import (
"github.com/influxdata/influxdb/bolt"
"github.com/influxdata/influxdb/http"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"go.uber.org/multierr"
)
func cmdBackup(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("backup", backupF)
cmd := opt.newCmd("backup", backupF, false)
cmd.Short = "Backup the data in InfluxDB"
cmd.Long = fmt.Sprintf(
`Backs up data and meta data for the running InfluxDB instance.
@ -43,16 +42,6 @@ var backupFlags struct {
Path string
}
func init() {
err := viper.BindEnv("PATH")
if err != nil {
panic(err)
}
if h := viper.GetString("PATH"); h != "" {
backupFlags.Path = h
}
}
func newBackupService() (influxdb.BackupService, error) {
return &http.BackupService{
Addr: flags.Host,

View File

@ -40,7 +40,7 @@ func newCmdBucketBuilder(svcsFn bucketSVCsFn, opts genericCLIOpts) *cmdBucketBui
}
func (b *cmdBucketBuilder) cmd() *cobra.Command {
cmd := b.newCmd("bucket", nil)
cmd := b.newCmd("bucket", nil, false)
cmd.Short = "Bucket management commands"
cmd.TraverseChildren = true
cmd.Run = seeHelp
@ -55,7 +55,7 @@ func (b *cmdBucketBuilder) cmd() *cobra.Command {
}
func (b *cmdBucketBuilder) cmdCreate() *cobra.Command {
cmd := b.newCmd("create", b.cmdCreateRunEFn)
cmd := b.newCmd("create", b.cmdCreateRunEFn, true)
cmd.Short = "Create bucket"
opts := flagOpts{
@ -115,7 +115,7 @@ func (b *cmdBucketBuilder) cmdCreateRunEFn(*cobra.Command, []string) error {
}
func (b *cmdBucketBuilder) cmdDelete() *cobra.Command {
cmd := b.newCmd("delete", b.cmdDeleteRunEFn)
cmd := b.newCmd("delete", b.cmdDeleteRunEFn, true)
cmd.Short = "Delete bucket"
cmd.Flags().StringVarP(&b.id, "id", "i", "", "The bucket ID, required if name isn't provided")
@ -178,7 +178,7 @@ func (b *cmdBucketBuilder) cmdDeleteRunEFn(cmd *cobra.Command, args []string) er
}
func (b *cmdBucketBuilder) cmdFind() *cobra.Command {
cmd := b.newCmd("list", b.cmdFindRunEFn)
cmd := b.newCmd("list", b.cmdFindRunEFn, true)
cmd.Short = "List buckets"
cmd.Aliases = []string{"find", "ls"}
@ -254,7 +254,7 @@ func (b *cmdBucketBuilder) cmdFindRunEFn(cmd *cobra.Command, args []string) erro
}
func (b *cmdBucketBuilder) cmdUpdate() *cobra.Command {
cmd := b.newCmd("update", b.cmdUpdateRunEFn)
cmd := b.newCmd("update", b.cmdUpdateRunEFn, true)
cmd.Short = "Update bucket"
opts := flagOpts{

View File

@ -185,9 +185,17 @@ func TestCmdBucket(t *testing.T) {
for _, tt := range tests {
fn := func(t *testing.T) {
defer addEnvVars(t, envVarsZeroMap)()
outBuf := new(bytes.Buffer)
defer func() {
if t.Failed() && outBuf.Len() > 0 {
t.Log(outBuf.String())
}
}()
builder := newInfluxCmdBuilder(
in(new(bytes.Buffer)),
out(ioutil.Discard),
out(outBuf),
)
cmd := builder.cmd(cmdFn(tt.expectedID))

View File

@ -39,7 +39,7 @@ type cmdConfigBuilder struct {
}
func (b *cmdConfigBuilder) cmd() *cobra.Command {
cmd := b.newCmd("config", nil)
cmd := b.newCmd("config", nil, false)
cmd.Short = "Config management commands"
cmd.Run = seeHelp
cmd.AddCommand(
@ -52,8 +52,7 @@ func (b *cmdConfigBuilder) cmd() *cobra.Command {
}
func (b *cmdConfigBuilder) cmdCreate() *cobra.Command {
cmd := b.newCmd("create", nil)
cmd.RunE = b.cmdCreateRunEFn
cmd := b.newCmd("create", b.cmdCreateRunEFn, false)
cmd.Short = "Create config"
cmd.Flags().StringVarP(&b.name, "name", "n", "", "The config name (required)")
cmd.MarkFlagRequired("name")
@ -116,8 +115,7 @@ func (b *cmdConfigBuilder) cmdCreateRunEFn(*cobra.Command, []string) error {
}
func (b *cmdConfigBuilder) cmdDelete() *cobra.Command {
cmd := b.newCmd("delete", nil)
cmd.RunE = b.cmdDeleteRunEFn
cmd := b.newCmd("delete", b.cmdDeleteRunEFn, false)
cmd.Short = "Delete config"
cmd.Flags().StringVarP(&b.name, "name", "n", "", "The config name (required)")
@ -161,9 +159,8 @@ func (b *cmdConfigBuilder) cmdDeleteRunEFn(cmd *cobra.Command, args []string) er
}
func (b *cmdConfigBuilder) cmdUpdate() *cobra.Command {
cmd := b.newCmd("set", b.cmdUpdateRunEFn)
cmd := b.newCmd("set", b.cmdUpdateRunEFn, false)
cmd.Aliases = []string{"update"}
cmd.RunE = b.cmdUpdateRunEFn
cmd.Short = "Update config"
cmd.Flags().StringVarP(&b.name, "name", "n", "", "The config name (required)")
cmd.MarkFlagRequired("name")
@ -228,8 +225,7 @@ func (b *cmdConfigBuilder) cmdUpdateRunEFn(*cobra.Command, []string) error {
}
func (b *cmdConfigBuilder) cmdList() *cobra.Command {
cmd := b.newCmd("list", nil)
cmd.RunE = b.cmdListRunEFn
cmd := b.newCmd("list", b.cmdListRunEFn, false)
cmd.Aliases = []string{"ls"}
cmd.Short = "List configs"
return cmd

View File

@ -12,7 +12,7 @@ import (
var deleteFlags http.DeleteRequest
func cmdDelete(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("delete", fluxDeleteF)
cmd := opt.newCmd("delete", fluxDeleteF, true)
cmd.Short = "Delete points from influxDB"
cmd.Long = `Delete points from influxDB, by specify start, end time
and a sql like predicate string.`

View File

@ -68,15 +68,20 @@ type genericCLIOpts struct {
runEWrapFn cobraRunEMiddleware
}
func (o genericCLIOpts) newCmd(use string, runE func(*cobra.Command, []string) error) *cobra.Command {
func (o genericCLIOpts) newCmd(use string, runE func(*cobra.Command, []string) error, useRunEMiddleware bool) *cobra.Command {
cmd := &cobra.Command{
Args: cobra.NoArgs,
Use: use,
RunE: runE,
}
if runE != nil && o.runEWrapFn != nil {
canWrapRunE := runE != nil && o.runEWrapFn != nil
if useRunEMiddleware && canWrapRunE {
cmd.RunE = o.runEWrapFn(runE)
} else if canWrapRunE {
cmd.RunE = runE
}
cmd.SetOut(o.w)
cmd.SetIn(o.in)
cmd.SetErr(o.errW)
@ -148,7 +153,7 @@ func (b *cmdInfluxBuilder) cmd(childCmdFns ...func(f *globalFlags, opt genericCL
setViperOptions()
})
cmd := b.newCmd("influx", nil)
cmd := b.newCmd("influx", nil, false)
cmd.Short = "Influx Client"
cmd.SilenceUsage = true

View File

@ -39,7 +39,7 @@ func newCmdOrgBuilder(svcFn orgSVCFn, opts genericCLIOpts) *cmdOrgBuilder {
}
func (b *cmdOrgBuilder) cmd() *cobra.Command {
cmd := b.newCmd("org", nil)
cmd := b.newCmd("org", nil, false)
cmd.Aliases = []string{"organization"}
cmd.Short = "Organization management commands"
cmd.Run = seeHelp
@ -56,7 +56,7 @@ func (b *cmdOrgBuilder) cmd() *cobra.Command {
}
func (b *cmdOrgBuilder) cmdCreate() *cobra.Command {
cmd := b.newCmd("create", b.createRunEFn)
cmd := b.newCmd("create", b.createRunEFn, true)
cmd.Short = "Create organization"
cmd.Flags().StringVarP(&b.name, "name", "n", "", "The name of organization that will be created")
@ -93,7 +93,7 @@ func (b *cmdOrgBuilder) createRunEFn(cmd *cobra.Command, args []string) error {
}
func (b *cmdOrgBuilder) cmdDelete() *cobra.Command {
cmd := b.newCmd("delete", b.deleteRunEFn)
cmd := b.newCmd("delete", b.deleteRunEFn, true)
cmd.Short = "Delete organization"
opts := flagOpts{
@ -144,7 +144,7 @@ func (b *cmdOrgBuilder) deleteRunEFn(cmd *cobra.Command, args []string) error {
}
func (b *cmdOrgBuilder) cmdFind() *cobra.Command {
cmd := b.newCmd("list", b.findRunEFn)
cmd := b.newCmd("list", b.findRunEFn, true)
cmd.Short = "List organizations"
cmd.Aliases = []string{"find", "ls"}
@ -207,7 +207,7 @@ func (b *cmdOrgBuilder) findRunEFn(cmd *cobra.Command, args []string) error {
}
func (b *cmdOrgBuilder) cmdUpdate() *cobra.Command {
cmd := b.newCmd("update", b.updateRunEFn)
cmd := b.newCmd("update", b.updateRunEFn, true)
cmd.Short = "Update organization"
opts := flagOpts{
@ -275,7 +275,7 @@ func (b *cmdOrgBuilder) updateRunEFn(cmd *cobra.Command, args []string) error {
}
func (b *cmdOrgBuilder) cmdMember() *cobra.Command {
cmd := b.newCmd("members", nil)
cmd := b.newCmd("members", nil, false)
cmd.Short = "Organization membership commands"
cmd.Run = seeHelp
@ -289,7 +289,7 @@ func (b *cmdOrgBuilder) cmdMember() *cobra.Command {
}
func (b *cmdOrgBuilder) cmdMemberList() *cobra.Command {
cmd := b.newCmd("list", b.memberListRunEFn)
cmd := b.newCmd("list", b.memberListRunEFn, true)
cmd.Short = "List organization members"
cmd.Aliases = []string{"find", "ls"}
@ -351,7 +351,7 @@ func (b *cmdOrgBuilder) memberListRunEFn(cmd *cobra.Command, args []string) erro
}
func (b *cmdOrgBuilder) cmdMemberAdd() *cobra.Command {
cmd := b.newCmd("add", b.memberAddRunEFn)
cmd := b.newCmd("add", b.memberAddRunEFn, true)
cmd.Short = "Add organization member"
cmd.Flags().StringVarP(&b.memberID, "member", "m", "", "The member ID")
@ -427,7 +427,7 @@ func (b *cmdOrgBuilder) memberAddRunEFn(cmd *cobra.Command, args []string) error
}
func (b *cmdOrgBuilder) cmdMemberRemove() *cobra.Command {
cmd := b.newCmd("remove", b.membersRemoveRunEFn)
cmd := b.newCmd("remove", b.membersRemoveRunEFn, true)
cmd.Short = "Remove organization member"
opts := flagOpts{

View File

@ -351,11 +351,22 @@ func TestCmdOrg(t *testing.T) {
testMemberFn := func(t *testing.T, cmdName string, cmdFn func() (func(*globalFlags, genericCLIOpts) *cobra.Command, *called), testCases ...testCase) {
for _, tt := range testCases {
fn := func(t *testing.T) {
defer addEnvVars(t, tt.envVars)()
envVars := tt.envVars
if len(envVars) == 0 {
envVars = envVarsZeroMap
}
defer addEnvVars(t, envVars)()
outBuf := new(bytes.Buffer)
defer func() {
if t.Failed() && outBuf.Len() > 0 {
t.Log(outBuf.String())
}
}()
builder := newInfluxCmdBuilder(
in(new(bytes.Buffer)),
out(ioutil.Discard),
out(outBuf),
)
nestedCmd, calls := cmdFn()
cmd := builder.cmd(nestedCmd)

View File

@ -43,7 +43,7 @@ func cmdPing(f *globalFlags, opts genericCLIOpts) *cobra.Command {
return nil
}
cmd := opts.newCmd("ping", runE)
cmd := opts.newCmd("ping", runE, true)
cmd.Short = "Check the InfluxDB /health endpoint"
cmd.Long = `Checks the health of a running InfluxDB instance by querying /health. Does not require valid token.`

View File

@ -87,7 +87,7 @@ func (b *cmdPkgBuilder) cmd() *cobra.Command {
}
func (b *cmdPkgBuilder) cmdPkgApply() *cobra.Command {
cmd := b.newCmd("pkg", b.pkgApplyRunEFn)
cmd := b.newCmd("pkg", b.pkgApplyRunEFn, true)
cmd.Short = "Apply a pkg to create resources"
b.org.register(cmd, false)
@ -180,7 +180,7 @@ func (b *cmdPkgBuilder) pkgApplyRunEFn(cmd *cobra.Command, args []string) error
}
func (b *cmdPkgBuilder) cmdPkgExport() *cobra.Command {
cmd := b.newCmd("export", b.pkgExportRunEFn)
cmd := b.newCmd("export", b.pkgExportRunEFn, true)
cmd.Short = "Export existing resources as a package"
cmd.AddCommand(b.cmdPkgExportAll())
@ -254,7 +254,7 @@ func (b *cmdPkgBuilder) pkgExportRunEFn(cmd *cobra.Command, args []string) error
}
func (b *cmdPkgBuilder) cmdPkgExportAll() *cobra.Command {
cmd := b.newCmd("all", b.pkgExportAllRunEFn)
cmd := b.newCmd("all", b.pkgExportAllRunEFn, true)
cmd.Short = "Export all existing resources for an organization as a package"
cmd.Flags().StringVarP(&b.file, "file", "f", "", "output file for created pkg; defaults to std out if no file provided; the extension of provided file (.yml/.json) will dictate encoding")
@ -318,9 +318,8 @@ func (b *cmdPkgBuilder) cmdPkgSummary() *cobra.Command {
return nil
}
cmd := b.newCmd("summary", nil)
cmd := b.newCmd("summary", runE, false)
cmd.Short = "Summarize the provided package"
cmd.RunE = runE
b.registerPkgFileFlags(cmd)
cmd.Flags().BoolVarP(&b.disableColor, "disable-color", "c", false, "Disable color in output")
@ -338,9 +337,8 @@ func (b *cmdPkgBuilder) cmdPkgValidate() *cobra.Command {
return pkg.Validate()
}
cmd := b.newCmd("validate", nil)
cmd := b.newCmd("validate", runE, false)
cmd.Short = "Validate the provided package"
cmd.RunE = runE
b.registerPkgFileFlags(cmd)

View File

@ -15,7 +15,7 @@ var queryFlags struct {
}
func cmdQuery(f *globalFlags, opts genericCLIOpts) *cobra.Command {
cmd := opts.newCmd("query [query literal or @/path/to/query.flux]", fluxQueryF)
cmd := opts.newCmd("query [query literal or @/path/to/query.flux]", fluxQueryF, true)
cmd.Short = "Execute a Flux query"
cmd.Long = `Execute a literal Flux query provided as a string,
or execute a literal Flux query contained in a file by specifying the file prefixed with an @ sign.`

View File

@ -19,7 +19,7 @@ var replFlags struct {
}
func cmdREPL(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("repl", replF)
cmd := opt.newCmd("repl", replF, true)
cmd.Short = "Interactive Flux REPL (read-eval-print-loop)"
cmd.Args = cobra.NoArgs

View File

@ -37,7 +37,7 @@ func newCmdSecretBuilder(svcsFn secretSVCsFn, opt genericCLIOpts) *cmdSecretBuil
}
func (b *cmdSecretBuilder) cmd() *cobra.Command {
cmd := b.newCmd("secret", nil)
cmd := b.newCmd("secret", nil, false)
cmd.Short = "Secret management commands"
cmd.Run = seeHelp
cmd.AddCommand(
@ -49,7 +49,7 @@ func (b *cmdSecretBuilder) cmd() *cobra.Command {
}
func (b *cmdSecretBuilder) cmdUpdate() *cobra.Command {
cmd := b.newCmd("update", b.cmdUpdateRunEFn)
cmd := b.newCmd("update", b.cmdUpdateRunEFn, true)
cmd.Short = "Update secret"
cmd.Flags().StringVarP(&b.key, "key", "k", "", "The secret key (required)")
cmd.Flags().StringVarP(&b.value, "value", "v", "", "Optional secret value for scripting convenience, using this might expose the secret to your local history")
@ -60,7 +60,7 @@ func (b *cmdSecretBuilder) cmdUpdate() *cobra.Command {
}
func (b *cmdSecretBuilder) cmdDelete() *cobra.Command {
cmd := b.newCmd("delete", b.cmdDeleteRunEFn)
cmd := b.newCmd("delete", b.cmdDeleteRunEFn, true)
cmd.Short = "Delete secret"
cmd.Flags().StringVarP(&b.key, "key", "k", "", "The secret key (required)")
@ -137,7 +137,7 @@ func (b *cmdSecretBuilder) cmdDeleteRunEFn(cmd *cobra.Command, args []string) er
}
func (b *cmdSecretBuilder) cmdFind() *cobra.Command {
cmd := b.newCmd("list", b.cmdFindRunEFn)
cmd := b.newCmd("list", b.cmdFindRunEFn, true)
cmd.Short = "List secrets"
cmd.Aliases = []string{"find", "ls"}
b.org.register(cmd, false)

View File

@ -29,7 +29,7 @@ var setupFlags struct {
}
func cmdSetup(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("setup", nil)
cmd := opt.newCmd("setup", nil, true)
cmd.RunE = setupF
cmd.Short = "Setup instance with initial user, org, bucket"

View File

@ -23,7 +23,7 @@ func cmdTask(f *globalFlags, opt genericCLIOpts) *cobra.Command {
return nil
}
cmd := opt.newCmd("task", runE)
cmd := opt.newCmd("task", runE, false)
cmd.Short = "Task management commands"
cmd.AddCommand(
@ -43,7 +43,7 @@ var taskCreateFlags struct {
}
func taskCreateCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("create [query literal or @/path/to/query.flux]", taskCreateF)
cmd := opt.newCmd("create [query literal or @/path/to/query.flux]", taskCreateF, true)
cmd.Args = cobra.ExactArgs(1)
cmd.Short = "Create task"
@ -127,7 +127,7 @@ var taskFindFlags struct {
}
func taskFindCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("list", taskFindF)
cmd := opt.newCmd("list", taskFindF, true)
cmd.Short = "List tasks"
cmd.Aliases = []string{"find", "ls"}
@ -235,7 +235,7 @@ var taskUpdateFlags struct {
}
func taskUpdateCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("update", taskUpdateF)
cmd := opt.newCmd("update", taskUpdateF, true)
cmd.Short = "Update task"
cmd.Flags().StringVarP(&taskUpdateFlags.id, "id", "i", "", "task ID (required)")
@ -309,7 +309,7 @@ var taskDeleteFlags struct {
}
func taskDeleteCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("delete", taskDeleteF)
cmd := opt.newCmd("delete", taskDeleteF, true)
cmd.Short = "Delete task"
cmd.Flags().StringVarP(&taskDeleteFlags.id, "id", "i", "", "task id (required)")
@ -371,7 +371,7 @@ func taskDeleteF(cmd *cobra.Command, args []string) error {
}
func taskLogCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("log", nil)
cmd := opt.newCmd("log", nil, false)
cmd.Run = seeHelp
cmd.Short = "Log related commands"
@ -388,7 +388,7 @@ var taskLogFindFlags struct {
}
func taskLogFindCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("list", taskLogFindF)
cmd := opt.newCmd("list", taskLogFindF, true)
cmd.Short = "List logs for task"
cmd.Aliases = []string{"find", "ls"}
@ -450,7 +450,7 @@ func taskLogFindF(cmd *cobra.Command, args []string) error {
}
func taskRunCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("run", nil)
cmd := opt.newCmd("run", nil, false)
cmd.Run = seeHelp
cmd.Short = "List runs for a task"
cmd.AddCommand(
@ -470,7 +470,7 @@ var taskRunFindFlags struct {
}
func taskRunFindCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("list", taskRunFindF)
cmd := opt.newCmd("list", taskRunFindF, true)
cmd.Short = "List runs for a task"
cmd.Aliases = []string{"find", "ls"}
@ -562,7 +562,7 @@ var runRetryFlags struct {
}
func taskRunRetryCmd(opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("retry", runRetryF)
cmd := opt.newCmd("retry", runRetryF, true)
cmd.Short = "retry a run"
cmd.Flags().StringVarP(&runRetryFlags.taskID, "task-id", "i", "", "task id (required)")

View File

@ -17,7 +17,7 @@ var transpileFlags struct {
}
func cmdTranspile(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("transpile [InfluxQL query]", transpileF)
cmd := opt.newCmd("transpile [InfluxQL query]", transpileF, false)
cmd.Args = cobra.ExactArgs(1)
cmd.Short = "Transpile an InfluxQL query to Flux source code"
cmd.Long = `Transpile an InfluxQL query to Flux source code.

View File

@ -50,7 +50,7 @@ func newCmdUserBuilder(svcsFn userSVCsFn, opt genericCLIOpts) *cmdUserBuilder {
}
func (b *cmdUserBuilder) cmd() *cobra.Command {
cmd := b.newCmd("user", nil)
cmd := b.newCmd("user", nil, false)
cmd.Short = "User management commands"
cmd.Run = seeHelp
cmd.AddCommand(
@ -65,7 +65,7 @@ func (b *cmdUserBuilder) cmd() *cobra.Command {
}
func (b *cmdUserBuilder) cmdPassword() *cobra.Command {
cmd := b.newCmd("password", b.cmdPasswordRunEFn)
cmd := b.newCmd("password", b.cmdPasswordRunEFn, true)
cmd.Short = "Update user password"
cmd.Flags().StringVarP(&b.id, "id", "i", "", "The user ID")
@ -75,7 +75,7 @@ func (b *cmdUserBuilder) cmdPassword() *cobra.Command {
}
func (b *cmdUserBuilder) cmdUpdate() *cobra.Command {
cmd := b.newCmd("update", b.cmdUpdateRunEFn)
cmd := b.newCmd("update", b.cmdUpdateRunEFn, true)
cmd.Short = "Update user"
cmd.Flags().StringVarP(&b.id, "id", "i", "", "The user ID (required)")
@ -192,7 +192,7 @@ func (b *cmdUserBuilder) cmdUpdateRunEFn(cmd *cobra.Command, args []string) erro
}
func (b *cmdUserBuilder) cmdCreate() *cobra.Command {
cmd := b.newCmd("create", b.cmdCreateRunEFn)
cmd := b.newCmd("create", b.cmdCreateRunEFn, true)
cmd.Short = "Create user"
opts := flagOpts{
@ -280,7 +280,7 @@ func (b *cmdUserBuilder) cmdCreateRunEFn(*cobra.Command, []string) error {
}
func (b *cmdUserBuilder) cmdFind() *cobra.Command {
cmd := b.newCmd("list", b.cmdFindRunEFn)
cmd := b.newCmd("list", b.cmdFindRunEFn, true)
cmd.Short = "List users"
cmd.Aliases = []string{"find", "ls"}
@ -330,7 +330,7 @@ func (b *cmdUserBuilder) cmdFindRunEFn(*cobra.Command, []string) error {
}
func (b *cmdUserBuilder) cmdDelete() *cobra.Command {
cmd := b.newCmd("delete", b.cmdDeleteRunEFn)
cmd := b.newCmd("delete", b.cmdDeleteRunEFn, true)
cmd.Short = "Delete user"
cmd.Flags().StringVarP(&b.id, "id", "i", "", "The user ID (required)")

View File

@ -24,7 +24,7 @@ var writeFlags struct {
}
func cmdWrite(f *globalFlags, opt genericCLIOpts) *cobra.Command {
cmd := opt.newCmd("write line protocol or @/path/to/points.txt", fluxWriteF)
cmd := opt.newCmd("write line protocol or @/path/to/points.txt", fluxWriteF, true)
cmd.Args = cobra.ExactArgs(1)
cmd.Short = "Write points to InfluxDB"
cmd.Long = `Write a single line of line protocol to InfluxDB,