cmd

package
v4.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// populated by ldflags
	GitCommit string
	GitTag    string
	BuildDate string
)

Functions

func New

func New(opts ...Option) *command

func Register

func Register(cmds ...*cli.Command)

Register CLI commands

func Run

func Run()

Run the default command

Types

type Cmd

type Cmd interface {
	// Options set within this command
	Options() Options
	// The cli app within this cmd
	App() *cli.App
	// Run executes the command
	Run() error
}
var (
	DefaultCmd Cmd = New()
)

type Option

type Option func(o *Options)

func Action

func Action(a func(*cli.Context) error) Option

Action to execute

func Before

func Before(f cli.BeforeFunc) Option

Before sets a function to be called before micro is setup

func Commands

func Commands(c ...*cli.Command) Option

Commands to add

func Description

func Description(d string) Option

Command line Description

func Flags

func Flags(f ...cli.Flag) Option

Flags to add

func Name

func Name(n string) Option

Command line Name

func Service

func Service() Option

Service for to execute

func Version

func Version(v string) Option

Command line Version

type Options

type Options struct {
	// Name of the application
	Name string
	// Description of the application
	Description string
	// Version of the application
	Version string
	// Action to execute when Run is called and there is no subcommand
	Action func(*cli.Context) error
	// TODO replace with built in command definition
	Commands []*cli.Command
	// TODO replace with built in flags definition
	Flags []cli.Flag
	// Other options for implementations of the interface
	// can be stored in a context
	Context context.Context
}

Directories

Path Synopsis
cli module
Package cli is a command line interface
Package cli is a command line interface
gen
Package gen provides the micro gen command which simply runs go generate
Package gen provides the micro gen command which simply runs go generate
init
Package init provides the micro init command for initialising plugins and imports
Package init provides the micro init command for initialising plugins and imports
new
Package new generates micro service templates
Package new generates micro service templates
run
Package runtime is the micro runtime
Package runtime is the micro runtime
shutdown
Package shutdown will issue a shutdown signal
Package shutdown will issue a shutdown signal
store
Package cli implements the `micro store` subcommands for example:
Package cli implements the `micro store` subcommands for example:
token
Package token contains CLI client token related helpers tToken files consist of one line per token, each token having the structure of `micro://envAddress/namespace[/id]:token`, ie.
Package token contains CLI client token related helpers tToken files consist of one line per token, each token having the structure of `micro://envAddress/namespace[/id]:token`, ie.
user
Package user handles the user cli command
Package user handles the user cli command
util
Package cliutil contains methods used across all cli commands @todo: get rid of os.Exits and use errors instread
Package cliutil contains methods used across all cli commands @todo: get rid of os.Exits and use errors instread
go-micro module
pkg module
service module
service/proto module
generator
The code generator for the plugin for the Google protocol buffer compiler.
The code generator for the plugin for the Google protocol buffer compiler.
examples module
plugin module
Package server is the micro server which runs the whole system
Package server is the micro server which runs the whole system
web
Package web is a web dashboard
Package web is a web dashboard

Jump to

Keyboard shortcuts

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