mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
stdout/stderr around A lot of functions in the cmd and ctl packages were passing these around and barely using them. Replaced them with a logger for most functions. Some functions get an io.Writer instead so that their tests can find the output they're looking for. More cleanup on fb-1766: reworked the tests that were using io.Pipe or os.Pipe to check their results so they now use a bytes.Buffer. Unexported some variables that didn't need to be exported. Fixed NewConfigCommand to use the provided stderr, not os.Stderr. Added tests for rbf_dump, rbf_page, and keygen, since those weren't being tested at all. Added chksum_test, final cleanup.
35 lines
1.4 KiB
Go
35 lines
1.4 KiB
Go
// Copyright 2021 Molecula Corp. All rights reserved.
|
|
package cmd
|
|
|
|
import (
|
|
"github.com/molecula/featurebase/v3/ctl"
|
|
"github.com/molecula/featurebase/v3/logger"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var cli *ctl.CLICommand
|
|
|
|
// newCLICommand runs the FeatureBase CLI subcommand for ingesting bulk data.
|
|
func newCLICommand(logdest logger.Logger) *cobra.Command {
|
|
cli = ctl.NewCLICommand(logdest)
|
|
cliCmd := &cobra.Command{
|
|
Use: "cli",
|
|
Short: "Query FB with SQL3 from the command line",
|
|
Long: ``,
|
|
RunE: usageErrorWrapper(cli),
|
|
}
|
|
|
|
flags := cliCmd.Flags()
|
|
flags.StringVarP(&cli.Host, "host", "", cli.Host, "hostname of FeatureBase.")
|
|
flags.StringVarP(&cli.Port, "port", "", cli.Port, "port of FeatureBase.")
|
|
flags.StringVar(&cli.HistoryPath, "history-path", cli.HistoryPath, "path for history files.")
|
|
flags.StringVar(&cli.OrganizationID, "org-id", cli.OrganizationID, "OrganizationID.")
|
|
flags.StringVar(&cli.DatabaseID, "db-id", cli.DatabaseID, "DatabaseID.")
|
|
|
|
flags.StringVar(&cli.ClientID, "client-id", cli.ClientID, "Cognito Client ID for FeatureBase Cloud access.")
|
|
flags.StringVar(&cli.Region, "region", cli.Region, "Cloud region for FeatureBase Cloud access (e.g. us-east-2).")
|
|
flags.StringVar(&cli.Email, "email", cli.Email, "Email address for FeatureBase Cloud access.")
|
|
flags.StringVar(&cli.Password, "password", cli.Password, "Password for FeatureBase Cloud access.")
|
|
|
|
return cliCmd
|
|
}
|