diff --git a/cmd/influx_inspect/export/export.go b/cmd/influx_inspect/export/export.go index bd1a3f7842..012fcc222d 100644 --- a/cmd/influx_inspect/export/export.go +++ b/cmd/influx_inspect/export/export.go @@ -57,17 +57,21 @@ func NewCommand() *Command { func (cmd *Command) Run(args ...string) error { var start, end string fs := flag.NewFlagSet("export", flag.ExitOnError) - fs.StringVar(&cmd.dataDir, "datadir", os.Getenv("HOME")+"/.influxdb/data", "Data storage path. [$HOME/.influxdb/data]") - fs.StringVar(&cmd.walDir, "waldir", os.Getenv("HOME")+"/.influxdb/wal", "Wal storage path. [$HOME/.influxdb/wal]") + fs.StringVar(&cmd.dataDir, "datadir", os.Getenv("HOME")+"/.influxdb/data", "Data storage path") + fs.StringVar(&cmd.walDir, "waldir", os.Getenv("HOME")+"/.influxdb/wal", "WAL storage path") fs.StringVar(&cmd.out, "out", os.Getenv("HOME")+"/.influxdb/export", "Destination file to export to") fs.StringVar(&cmd.database, "database", "", "Optional: the database to export") - fs.StringVar(&cmd.retentionPolicy, "retention", "", "Optional: the retention policy to export (requires db parameter to be specified)") + fs.StringVar(&cmd.retentionPolicy, "retention", "", "Optional: the retention policy to export (requires -database)") fs.StringVar(&start, "start", "", "Optional: the start time to export") fs.StringVar(&end, "end", "", "Optional: the end time to export") fs.BoolVar(&cmd.compress, "compress", false, "Compress the output") fs.SetOutput(cmd.Stdout) - fs.Usage = cmd.printUsage + fs.Usage = func() { + fmt.Fprintf(cmd.Stdout, "Exports TSM files into InfluxDB line protocol format.\n\n") + fmt.Fprintf(cmd.Stdout, "Usage: %s export [flags]\n\n", filepath.Base(os.Args[0])) + fs.PrintDefaults() + } if err := fs.Parse(args); err != nil { return err @@ -390,33 +394,3 @@ func (cmd *Command) writeWALFiles(w io.WriteCloser, files []string, key string) return nil } - -// printUsage prints the usage message to STDERR. -func (cmd *Command) printUsage() { - usage := fmt.Sprintf(`Exports TSM files into InfluxDB line protocol format. - -Usage: influx_inspect export [flags] - - -datadir - Data storage path - Defaults to "%[1]s/.influxdb/data". - -waldir - WAL storage path - Defaults to "%[1]s/.influxdb/wal". - -out - Destination file to export to. - Defaults to "%[1]s/.influxdb/export". - -database - Optional. Database to export. - -retention - Optional. the retention policy to export (requires db parameter to be specified). - -start-time