tool

package
v0.0.0-...-a0fa9d7 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Byte32ToBigInt

func Byte32ToBigInt(bytes [32]byte) *big.Int

func Byte32ToString

func Byte32ToString(bytes [32]byte) string

func DivideToFloat

func DivideToFloat(x, y *big.Int) float64

func FetchSelfPublicIP

func FetchSelfPublicIP() (string, error)

func IsIgnoreException

func IsIgnoreException(err error) bool

func LoadJSONFile

func LoadJSONFile(path string, data any) error

func MustItfToJSONStr

func MustItfToJSONStr(v any) string

func MustItfToJSONStrIndex

func MustItfToJSONStrIndex(v any) string

func PathExists

func PathExists(path string) (bool, error)

func StrToByte32

func StrToByte32(s string) ([32]byte, error)

func StringToAddressHookFunc

func StringToAddressHookFunc() mapstructure.DecodeHookFunc

func StringToBigIntHookFunc

func StringToBigIntHookFunc() mapstructure.DecodeHookFunc

func StringToDecimalHookFunc

func StringToDecimalHookFunc() mapstructure.DecodeHookFunc

Types

type IgnoreException

type IgnoreException struct {
	// contains filtered or unexported fields
}

func NewIgnoreException

func NewIgnoreException(err error) IgnoreException

func (IgnoreException) Error

func (e IgnoreException) Error() string

type UserPrompter

type UserPrompter interface {
	// PromptInput displays the given prompt to the user and requests some textual
	// data to be entered, returning the input of the user.
	PromptInput(prompt string) (string, error)

	// PromptPassword displays the given prompt to the user and requests some textual
	// data to be entered, but one which must not be echoed out into the terminal.
	// The method returns the input provided by the user.
	PromptPassword(prompt string) (string, error)

	// PromptConfirm displays the given prompt to the user and requests a boolean
	// choice to be made, returning that choice.
	PromptConfirm(prompt string) (bool, error)

	// SetHistory sets the input scrollback history that the prompter will allow
	// the user to scroll back to.
	SetHistory(history []string)

	// AppendHistory appends an entry to the scrollback history. It should be called
	// if and only if the prompt to append was a valid command.
	AppendHistory(command string)

	// ClearHistory clears the entire history
	ClearHistory()

	// SetWordCompleter sets the completion function that the prompter will call to
	// fetch completion candidates when the user presses tab.
	SetWordCompleter(completer liner.WordCompleter)
}

UserPrompter defines the methods needed by the console to prompt the user for various types of inputs.

func NewTerminalPrompter

func NewTerminalPrompter() UserPrompter

NewTerminalPrompter creates a liner based user input prompter working off the standard input and output streams.

Jump to

Keyboard shortcuts

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