app

package
v0.0.0-...-c1d1bf9 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPrompt is used when the cluster status cannot be retrieved
	DefaultPrompt = "\x1b[34melasticsearch> \x1b[0m"
	// GreenPrompt is used when the cluster status is green
	GreenPrompt = "\x1b[32melasticsearch> \x1b[0m"
	// YellowPrompt is used when the cluster status is yellow
	YellowPrompt = "\x1b[33melasticsearch> \x1b[0m"
	// RedPrompt is used when the cluster status is red
	RedPrompt = "\x1b[31melasticsearch> \x1b[0m"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	// contains filtered or unexported fields
}

Application contains the full application and its dependencies

func New

func New(config *Config) (*Application, error)

New creates a new instance of elasticsearch-cli from the passed Config

func (*Application) HandleCli

func (app *Application) HandleCli(args []string) error

HandleCli handles the the interaction between the validated input and remote HTTP calls to the specified host including the call to the JSON formatter

func (*Application) Interactive

func (app *Application) Interactive() error

Interactive runs the application like a readline / REPL

type Config

type Config struct {
	User         string `mapstructure:"user"`
	Pass         string `mapstructure:"pass"`
	Host         string `mapstructure:"host"`
	Port         int    `mapstructure:"port"`
	Verbose      bool   `mapstructure:"verbose"`
	PollInterval int    `mapstructure:"poll-interval"`
	Timeout      int    `mapstructure:"timeout"`
	Insecure     bool   `mapstructure:"insecure"`
	Headers      map[string]string
	Client       *http.Client
}

Config for elasticsearch-cli Application

type Formatter

type Formatter func(input *http.Response, verbose bool, interactive bool, writer io.Writer) error

Formatter formats the HTTPResponse to Stdout

type Poller

type Poller interface {
	// Start the IndexPoller indefinitely, which will get the cluster indexList
	// And will send the results back to the channel
	Start()
	// Stop makes the indexPoller stop querying the Elasticsearch endpoint
	// additionally closing all of the channels
	Stop()
}

Poller is the responsible for polling ElasticSearch and retrieving endpoints to autocomplete the CLI

Jump to

Keyboard shortcuts

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