utils

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: GPL-3.0 Imports: 13 Imported by: 2

Documentation

Index

Constants

View Source
const (
	VersionMajor = 1          // Major version component of the current release
	VersionMinor = 0          // Minor version component of the current release
	VersionPatch = 0          // Patch version component of the current release
	VersionMeta  = "unstable" // Version metadata to append to the version string
)

Variables

View Source
var (
	AppNameFlag = cli.StringFlag{
		Name:  "name",
		Usage: "Application Name",
	}

	SymbolFlag = cli.StringFlag{
		Name:  "symbol, s",
		Usage: "Currency symbol",
	}

	BatchFlag = cli.BoolFlag{
		Name:  "batch",
		Usage: "Create address with batch",
	}

	InitFlag = cli.BoolFlag{
		Name:  "i, init",
		Usage: "Init operate",
	}

	LogDirFlag = cli.StringFlag{
		Name:  "logdir",
		Usage: "log files directory",
	}

	LogDebugFlag = cli.BoolFlag{
		Name:  "debug",
		Usage: "print debug log info",
	}

	MQUrl = cli.StringFlag{
		Name:  "mqu, mqurl",
		Usage: "config mq's url",
	}

	MQAccount = cli.StringFlag{
		Name:  "mqa, mqaccount",
		Usage: "config mq's account",
	}

	MQPassword = cli.StringFlag{
		Name:  "mqp, mqpassword",
		Usage: "config mq's password",
	}

	MQExchange = cli.StringFlag{
		Name:  "mqe, mqexchange",
		Usage: "config mq's exchange",
	}

	EnableBlockScan = cli.StringFlag{
		Name:  "EnableBlockScan",
		Usage: "start the block scan",
	}

	ISTestNet = cli.StringFlag{
		Name:  "is_test_net",
		Usage: "start the test net",
	}
)
View Source
var (
	CommandHelpTemplate = `` /* 486-byte string literal not displayed */

)
View Source
var Version = func() string {
	v := fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

Version holds the textual version string.

Functions

func GlobalBig

func GlobalBig(ctx *cli.Context, name string) *big.Int

GlobalBig returns the value of a BigFlag from the global flag set.

func NewApp

func NewApp(gitCommit, usage string) *cli.App

NewApp creates an app with sane defaults.

func SetupLog

func SetupLog(logDir, logFile string, debug bool)

SetupLog 配置日志

Types

type BigFlag

type BigFlag struct {
	Name  string
	Value *big.Int
	Usage string
}

BigFlag is a command line flag that accepts 256 bit big integers in decimal or hexadecimal syntax.

func (BigFlag) GetName

func (f BigFlag) GetName() string

func (BigFlag) String

func (f BigFlag) String() string

type DirectoryFlag

type DirectoryFlag struct {
	Name  string
	Value DirectoryString
	Usage string
}

Custom cli.Flag type which expand the received string to an absolute path. e.g. ~/.ethereum -> /home/username/.ethereum

func (DirectoryFlag) Apply

func (self DirectoryFlag) Apply(set *flag.FlagSet)

called by cli library, grabs variable from environment (if in env) and adds variable to flag set for parsing.

func (DirectoryFlag) GetName

func (self DirectoryFlag) GetName() string

func (*DirectoryFlag) Set

func (self *DirectoryFlag) Set(value string)

func (DirectoryFlag) String

func (self DirectoryFlag) String() string

type DirectoryString

type DirectoryString struct {
	Value string
}

Custom type which is registered in the flags library which cli uses for argument parsing. This allows us to expand Value to an absolute path when the argument is parsed

func (*DirectoryString) Set

func (self *DirectoryString) Set(value string) error

func (*DirectoryString) String

func (self *DirectoryString) String() string

type TextMarshaler

type TextMarshaler interface {
	encoding.TextMarshaler
	encoding.TextUnmarshaler
}

func GlobalTextMarshaler

func GlobalTextMarshaler(ctx *cli.Context, name string) TextMarshaler

GlobalTextMarshaler returns the value of a TextMarshalerFlag from the global flag set.

type TextMarshalerFlag

type TextMarshalerFlag struct {
	Name  string
	Value TextMarshaler
	Usage string
}

TextMarshalerFlag wraps a TextMarshaler value.

func (TextMarshalerFlag) Apply

func (f TextMarshalerFlag) Apply(set *flag.FlagSet)

func (TextMarshalerFlag) GetName

func (f TextMarshalerFlag) GetName() string

func (TextMarshalerFlag) String

func (f TextMarshalerFlag) String() string

Jump to

Keyboard shortcuts

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