common

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitOnErr

func ExitOnErr(cmd *cobra.Command, errFmt string, err error)

ExitOnErr prints error and exits with a code that matches one of the common errors from sdk library. If no errors found, exits with 1 code. Does nothing if passed error in nil.

func ParseEpoch added in v0.30.0

func ParseEpoch(cmd *cobra.Command, flag string) (uint64, bool, error)

ParseEpoch parses epoch argument. Second return value is true if the specified epoch is relative, and false otherwise.

func PrettyPrintJSON

func PrettyPrintJSON(cmd *cobra.Command, m json.Marshaler, entity string)

PrettyPrintJSON prints m as an indented JSON to the cmd output.

func PrettyPrintNetMap added in v0.33.0

func PrettyPrintNetMap(cmd *cobra.Command, nm netmap.NetMap)

PrettyPrintNetMap print information about network map

func PrettyPrintNodeInfo added in v0.33.0

func PrettyPrintNodeInfo(cmd *cobra.Command, node netmap.NodeInfo,
	index int, indent string, short bool)

PrettyPrintNodeInfo print information about network node with given indent and index. To avoid printing attribute list use short parameter.

func PrettyPrintUnixTime added in v0.28.3

func PrettyPrintUnixTime(s string) string

PrettyPrintUnixTime interprets s as unix timestamp and prints it as a date. Is s is invalid, "malformed" is returned.

func PrintChecksum added in v0.29.0

func PrintChecksum(cmd *cobra.Command, name string, recv func() (checksum.Checksum, bool))

PrintChecksum prints checksum.

func PrintVerbose

func PrintVerbose(format string, a ...interface{})

PrintVerbose prints to the stdout if the commonflags.Verbose flag is on.

func ReadBearerToken

func ReadBearerToken(cmd *cobra.Command, flagname string) *bearer.Token

ReadBearerToken reads bearer token from the path provided in a specified flag.

func ReadEACL

func ReadEACL(cmd *cobra.Command, eaclPath string) *eacl.Table

ReadEACL reads extended ACL table from eaclPath.

func ReadSessionToken

func ReadSessionToken(cmd *cobra.Command, dst json.Unmarshaler, fPath string)

ReadSessionToken calls ReadSessionTokenErr and exists on error.

func ReadSessionTokenErr

func ReadSessionTokenErr(dst json.Unmarshaler, fPath string) error

ReadSessionTokenErr reads session token as JSON file with session token from path provided in a specified flag.

Types

This section is empty.

Jump to

Keyboard shortcuts

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