cliutil

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: LGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package cliutil provides utility functions intended for sharing by the main packages of multiple executables.

Index

Constants

View Source
const (
	// FlagLogLevel is the log level flag.
	FlagLogLevel = "log-level"
)

Variables

This section is empty.

Functions

func ExpandBootnodes

func ExpandBootnodes(nodesCLI []string) []string

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 GetVersion

func GetVersion() string

GetVersion returns our version string for an executable

func ReadETHAddress added in v0.3.0

func ReadETHAddress(ctx *cli.Context, flagName string) (ethcommon.Address, error)

ReadETHAddress reads a string flag and parses to an ethereum Address type

func ReadPositiveUnsignedDecimalFlag added in v0.3.0

func ReadPositiveUnsignedDecimalFlag(ctx *cli.Context, flagName string) (*apd.Decimal, error)

ReadPositiveUnsignedDecimalFlag reads a string flag and parses it into an *apd.Decimal, verifying that the value is strictly > 0.

func ReadUnsignedDecimalFlag

func ReadUnsignedDecimalFlag(ctx *cli.Context, flagName string) (*apd.Decimal, error)

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.

Jump to

Keyboard shortcuts

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