cli

package
v0.0.0-...-828d3b4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HomeFlag     = "home"
	TraceFlag    = "trace"
	OutputFlag   = "output"
	EncodingFlag = "encoding"
)

Variables

This section is empty.

Functions

func AddCommand

func AddCommand(parent, child *cobra.Command)

func ParseLogLevel

func ParseLogLevel(lvl string, logger log.Logger, defaultLogLevelValue string) (log.Logger, error)

ParseLogLevel parses complex log level - comma-separated list of module:level pairs with an optional *:level pair (* means all other modules).

Example:

ParseLogLevel("consensus:debug,mempool:debug,*:error", log.NewTMLogger(os.Stdout), "info")

Types

type Executable

type Executable interface {
	Execute() error
}

Executable is the minimal interface to *corba.Command, so we can wrap if desired before the test

type Executor

type Executor struct {
	*cobra.Command
	Exit func(int) // this is os.Exit by default, override in tests
}

Executor wraps the cobra Command with a nicer Execute method

func PrepareBaseCmd

func PrepareBaseCmd(cmd *cobra.Command, envPrefix, defaultHome string) Executor

PrepareBaseCmd is meant for aaexplorer and other servers

func PrepareMainCmd

func PrepareMainCmd(cmd *cobra.Command, envPrefix, defaultHome string) Executor

PrepareMainCmd is meant for client side libs that want some more flags

This adds --encoding (hex, btc, base64) and --output (text, json) to the command. These only really make sense in interactive commands.

func (Executor) Execute

func (e Executor) Execute() error

execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

type ExitCoder

type ExitCoder interface {
	ExitCode() int
}

Jump to

Keyboard shortcuts

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