Documentation ¶
Overview ¶
Package cliutil provides utility functions intended for sharing by the main packages of multiple executables.
Index ¶
- Constants
- func ExpandBootnodes(nodesCLI []string) []string
- func GetEthereumPrivateKey(ethPrivKeyFile string, env common.Environment, devXMRMaker, devXMRTaker bool) (*ecdsa.PrivateKey, error)
- func GetVersion() string
- func ReadETHAddress(ctx *cli.Context, flagName string) (ethcommon.Address, error)
- func ReadPositiveUnsignedDecimalFlag(ctx *cli.Context, flagName string) (*apd.Decimal, error)
- func ReadUnsignedDecimalFlag(ctx *cli.Context, flagName string) (*apd.Decimal, error)
- func SetLogLevels(level string)
- func SetLogLevelsFromContext(c *cli.Context) error
- func SignalHandler(ctx context.Context, cancel context.CancelFunc, log *logging.ZapEventLogger)
Constants ¶
const (
// FlagLogLevel is the log level flag.
FlagLogLevel = "log-level"
)
Variables ¶
This section is empty.
Functions ¶
func ExpandBootnodes ¶
ExpandBootnodes expands the boot nodes passed on the command line that can be specified individually with multiple flags, but can also contain multiple boot nodes passed to single flag separated by commas.
func GetEthereumPrivateKey ¶
func GetEthereumPrivateKey(ethPrivKeyFile string, env common.Environment, devXMRMaker, devXMRTaker bool) ( *ecdsa.PrivateKey, error, )
GetEthereumPrivateKey reads or creates and returns an ethereum private key for the given the CLI options.
func ReadETHAddress ¶ added in v0.3.0
ReadETHAddress reads a string flag and parses to an ethereum Address type
func ReadPositiveUnsignedDecimalFlag ¶ added in v0.3.0
ReadPositiveUnsignedDecimalFlag reads a string flag and parses it into an *apd.Decimal, verifying that the value is strictly > 0.
func ReadUnsignedDecimalFlag ¶
ReadUnsignedDecimalFlag reads a string flag and parses it into an *apd.Decimal, verifying that the value is >= 0.
func SetLogLevels ¶
func SetLogLevels(level string)
SetLogLevels sets the log levels for all packages.
func SetLogLevelsFromContext ¶
func SetLogLevelsFromContext(c *cli.Context) error
SetLogLevelsFromContext sets the log levels for all packages from the CLI context.
func SignalHandler ¶
func SignalHandler(ctx context.Context, cancel context.CancelFunc, log *logging.ZapEventLogger)
SignalHandler handles OS signals and shuts down the program if necessary.
Types ¶
This section is empty.