cli

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2018 License: AGPL-3.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunWatcher added in v0.3.0

func RunWatcher(ctx context.Context, watcher lookout.Watcher, eventHandler lookout.EventHandler) error

RunWatcher starts the watcher with the given handler callback. On failure the watcher is restarted

Types

type App

type App struct {
	*flags.Parser

	Name string
}

App defines the CLI application that will be run.

func New

func New(name string) *App

New creates a new App, including default values.

func (*App) RunMain

func (app *App) RunMain()

RunMain parses arguments and runs commands

type CommonOptions

type CommonOptions struct {
	LogOptions
}

CommonOptions contains common flags for all commands

type DBOptions added in v0.0.4

type DBOptions struct {
	DB string `` /* 157-byte string literal not displayed */
}

DBOptions contains common flags for commands using the DB

func (*DBOptions) InitDB added in v0.3.0

func (c *DBOptions) InitDB() (*sql.DB, error)

type LogOptions

type LogOptions struct {
	LogLevel       string `long:"log-level" env:"LOG_LEVEL" default:"info" description:"Logging level (info, debug, warning or error)"`
	LogFormat      string `long:"log-format" env:"LOG_FORMAT" description:"log format (text or json), defaults to text on a terminal and json otherwise"`
	LogFields      string `long:"log-fields" env:"LOG_FIELDS" description:"default fields for the logger, specified in json"`
	LogForceFormat bool   `long:"log-force-format" env:"LOG_FORCE_FORMAT" description:"ignore if it is running on a terminal or not"`
}

LogOptions defines logging flags. It is meant to be embedded in a command struct.

type QueueOptions added in v0.3.0

type QueueOptions struct {
	Queue  string `long:"queue" env:"LOOKOUT_QUEUE" default:"lookout" description:"queue name"`
	Broker string `long:"broker" env:"LOOKOUT_BROKER" default:"amqp://localhost:5672" description:"broker service URI"`

	Q queue.Queue
}

QueueOptions contains common flags for commands using a Queue

func (*QueueOptions) InitQueue added in v0.3.0

func (c *QueueOptions) InitQueue() error

InitQueue initializes the queue from the given cli options.

type VersionCommand added in v0.1.4

type VersionCommand struct {
	// Name of the binary
	Name string
	// Version of the binary
	Version string
	// Build of the binary
	Build string
}

VersionCommand represents the `version` command of the CLI.

func (*VersionCommand) Execute added in v0.1.4

func (v *VersionCommand) Execute(args []string) error

Execute prints the build information provided at the compilation time.

Jump to

Keyboard shortcuts

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