cmd

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stopables represents extra closers to close when stopping
	Stopables = []Stoppable{}
	// WaitGroup is used to add processes to wait for and pass to goroutines
	WaitGroup sync.WaitGroup
)
View Source
var BuildVersion = "dev"

BuildVersion represents the built binary version

View Source
var (
	// ErrUnsupportedScheme is returned by Execute if an invalid scheme is given as the network address
	ErrUnsupportedScheme = errors.New("unsupported net scheme")
)
View Source
var Logger *zap.Logger

Logger represents the command line logger

Functions

func ConfigurePlugins

func ConfigurePlugins() error

func Execute

func Execute(
	root *cobra.Command,
	server Server,
	preFunc func() error,
)

Execute runs a given root cmd with the given grpc server

func GetViperAttr

func GetViperAttr(attrType dockerregistryproxyv1.ConfigType, attrName string) interface{}

func HandleErr

func HandleErr(err error)

HandleErr handles cmd errors

func LoadPlugins

func LoadPlugins(rootCmd *cobra.Command) error

func New

func New(programName string) *cobra.Command

New returns a new root Cobra cmd with some default flags and graceful stopping

func NewGRPCConn

func NewGRPCConn(host string) (*grpc.ClientConn, error)

NewGRPCConn returns a new GRPC connection

func NewGRPCServer

func NewGRPCServer() *grpc.Server

NewGRPCServer returns a new GRPC server with the zap and recovery interceptors

func NewHTTPServer

func NewHTTPServer() *http.Server

NewHTTPServer returns a new HTTP server

Types

type Server

type Server interface {
	Serve(net.Listener) error
}

Server represents a server type

type Stoppable

type Stoppable interface {
	Stop()
	Run(*sync.WaitGroup)
}

Stoppable represents a stoppable type

Jump to

Keyboard shortcuts

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