code: func (cmd *Command) Run(args ...string) error {
  	fs := flag.NewFlagSet("buildtsi", flag.ExitOnError)
  	dataDir := fs.String("datadir", "", "data directory")
  	walDir := fs.String("waldir", "", "WAL directory")
  	fs.IntVar(&cmd.concurrency, "concurrency", runtime.GOMAXPROCS(0), "Number of workers to dedicate to shard index building. Defaults to GOMAXPROCS")
  	fs.StringVar(&cmd.databaseFilter, "database", "", "optional: database name")
  	fs.StringVar(&cmd.retentionFilter, "retention", "", "optional: retention policy")
  	fs.StringVar(&cmd.shardFilter, "shard", "", "optional: shard id")
  	fs.Int64Var(&cmd.maxLogFileSize, "max-log-file-size", tsi1.DefaultMaxIndexLogFileSize, "optional: maximum log file size")
  	fs.Uint64Var(&cmd.maxCacheSize, "max-cache-size", tsm1.DefaultCacheMaxMemorySize, "optional: maximum cache size")
  	fs.IntVar(&cmd.batchSize, "batch-size", defaultBatchSize, "optional: set the size of the batches we write to the index. Setting this can have adverse affects on performance and heap requirements")
  	fs.BoolVar(&cmd.Verbose, "v", false, "verbose")
  	fs.SetOutput(cmd.Stdout)
  	if err := fs.Parse(args); err != nil {
  		return err
  	} else if fs.NArg() > 0 || *dataDir == "" || *walDir == "" {
  		fs.Usage()
  		return nil
  	}
  	cmd.Logger = logger.New(cmd.Stderr)
  
  	return cmd.run(*dataDir, *walDir)
  }
docs: // Run executes the command.