utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbiDecodeString

func AbiDecodeString(bz []byte) (string, error)

func AbiEncodeString

func AbiEncodeString(str string) ([]byte, error)

func BeautifyJson

func BeautifyJson(bzJson []byte) ([]byte, error)

BeautifyJson beautifies the given json.

func ConvertDisplayWithExponentIntoRaw added in v1.4.0

func ConvertDisplayWithExponentIntoRaw(display string, exponent int, decimalsPoint rune) (number, highNumber, lowNumber *big.Int, err error)

func ConvertNumberIntoDisplayWithExponent added in v1.4.0

func ConvertNumberIntoDisplayWithExponent(number *big.Int, exponent int) (display string, highNumber, lowNumber *big.Int, err error)

func ExitOnErr added in v1.4.0

func ExitOnErr(err error, msg string)

ExitOnErr exit the app with code 1 if error. Or does nothing if no error.

func GetGroupsOfUser

func GetGroupsOfUser(username string) ([]string, error)

func GetOperationUserInfo

func GetOperationUserInfo() (operationUserInfo *types.OperationUserInfo, err error)

func HasBinaryName

func HasBinaryName(binaryName string) bool

func IsDarwin

func IsDarwin() bool

func IsLinux

func IsLinux() bool

func IsSuperUser

func IsSuperUser(username string) (isSuperUser bool, err error)

func ProvidedArgsOrFromPipe added in v1.4.0

func ProvidedArgsOrFromPipe(providedArgs []string) (outputArgs []string, err error)

ProvidedArgsOrFromPipe will prioritize provided args, if not provided, it will try to read from pipe.

func RequireArgs added in v1.4.0

func RequireArgs(args []string, cmd *cobra.Command)

RequireArgs will exit program if no arg provided.

func RequireExactArgsCount added in v1.4.0

func RequireExactArgsCount(args []string, want int, cmd *cobra.Command)

RequireExactArgsCount will exit program if number of arguments is not equal to want.

func TryPrintBeautyJson added in v1.4.0

func TryPrintBeautyJson(bz []byte)

TryPrintBeautyJson tries to beautify the given json and print it. If failed to beautify, it will print the original json.

Types

This section is empty.

Jump to

Keyboard shortcuts

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