cli

package
v3.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2023 License: Apache-2.0, Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package cli contains a FeatureBase command line interface.

Index

Constants

This section is empty.

Variables

View Source
var (
	Stdin  io.ReadCloser = os.Stdin
	Stdout io.Writer     = os.Stdout
	Stderr io.Writer     = os.Stderr
)

Functions

This section is empty.

Types

type CloudAuthConfig added in v3.33.0

type CloudAuthConfig struct {
	ClientID string `json:"client-id"`
	Region   string `json:"region"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

type Command added in v3.33.0

type Command struct {
	Queryer Queryer `json:"-"`

	Stdin  io.ReadCloser `json:"-"`
	Stdout io.Writer     `json:"-"`
	Stderr io.Writer     `json:"-"`

	Config *Config `json:"config"`

	// Commands contains optional commands provided via one or more `-c` (or
	// `--command`) flags. If this is non-empty, the cli will run in
	// non-interactive mode; i.e. it will quit after the command is complete.
	Commands []string `json:"commands"`

	// Files contains optional files provided via one or more `-f` (or `--file`)
	// flags. If this is non-empty, the cli will run in non-interactive mode;
	// i.e. it will quit after the command is complete.
	Files []string `json:"files"`
	// contains filtered or unexported fields
}

func NewCommand added in v3.33.0

func NewCommand(logdest logger.Logger) *Command

func (*Command) Errorf added in v3.33.0

func (cmd *Command) Errorf(format string, a ...any)

Errorf is a helper method which sends the given payload to stderr.

func (*Command) Outputf added in v3.33.0

func (cmd *Command) Outputf(format string, a ...any)

Outputf is a helper method which sends the given payload to output.

func (*Command) Printf added in v3.33.0

func (cmd *Command) Printf(format string, a ...any)

Printf is a helper method which sends the given payload to stdout.

func (*Command) Run added in v3.33.0

func (cmd *Command) Run(ctx context.Context) error

Run is the main entry-point to the CLI.

type Config added in v3.33.0

type Config struct {
	Host string `json:"host"`
	Port string `json:"port"`

	OrganizationID string `json:"org-id"`
	Database       string `json:"db"`

	// CloudAuth
	CloudAuth CloudAuthConfig `json:"cloud-auth"`

	HistoryPath string `json:"history-path"`
}

Config represents the configuration for the command.

type Queryer

type Queryer interface {
	Query(org string, db string, sql io.Reader) (*featurebase.WireQueryResponse, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL