cli

package
v0.0.0-...-07cc366 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log *clog.Log

Log is the one and only logger for the application. nolint

Functions

func Run

func Run(cliStructReference interface{}, options RunOptions)

Run is the main entry point if no custom arguments are needed.

func RunWithArguments

func RunWithArguments(cliStructReference interface{}, options RunOptions, customArgs ...interface{})

RunWithArguments is the main entry point when there are custom arguments.

Types

type ApplicationType

type ApplicationType = int

ApplicationType specifies the type of the application, e.g. Utility.

const (
	// Daemon application type, e.g. can run in the background.
	Daemon ApplicationType = iota
	// Utility application type.
	Utility
)

type LogConfigFile

type LogConfigFile struct {
	ApplicationName string
	LogDirectory    string
}

The LogConfigFile struct contains configuration when the log output is a file.

type LogFileString

type LogFileString string

The LogFileString is the name of the log file.

func (LogFileString) AfterApply

func (o LogFileString) AfterApply(log *clog.Log) error

AfterApply hook is called when log file name is set from the command line.

type LogLevelString

type LogLevelString string

The LogLevelString is the log level.

func (LogLevelString) AfterApply

func (o LogLevelString) AfterApply(log *clog.Log) error

AfterApply hook is called when log level is set from the command line.

type Options

type Options struct {
	LogLevel LogLevelString `help:"the log level"`
	LogFile  LogFileString  `help:"log output file" default:""`
}

The Options struct is used to configure the log from the command line.

type RunOptions

type RunOptions struct {
	Version         string
	ApplicationType ApplicationType
	LogConfig       interface{}
}

The RunOptions struct contains runtime options.

Jump to

Keyboard shortcuts

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