util

package
v1.8.18 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NoMaxArgs          = -1
	ErrNoPreviousBuild = "No previous build found"
)

Variables

This section is empty.

Functions

func ArgsToJSON added in v1.8.17

func ArgsToJSON(args []string) []interface{}

func CheckAndConvertInt

func CheckAndConvertInt(num string, name string) int

func CheckAndConvertInt64

func CheckAndConvertInt64(num string, name string) int64

func CheckArguments

func CheckArguments(cmd *cobra.Command, args []string, min int, max int)

func CheckIntegerBounds

func CheckIntegerBounds(cmd *cobra.Command, name string, val int, min int, max int)

func CheckLoad added in v1.8.17

func CheckLoad()

func ClientNotSupported

func ClientNotSupported(client string)

func CreateAuthNHeader added in v1.7.1

func CreateAuthNHeader() (string, error)

func CreateTable added in v1.8.17

func CreateTable() error

func Delete added in v1.8.17

func Delete(key string) error

Delete deletes the value stored at key

func Exists added in v1.8.17

func Exists(key string) bool

func FlagNotProvidedError added in v1.8.17

func FlagNotProvidedError(cmd *cobra.Command, flagName string)

func GetAsBool added in v1.8.17

func GetAsBool(input string) (bool, error)

func GetBoolFlagValue added in v1.8.17

func GetBoolFlagValue(cmd *cobra.Command, flag string) bool

func GetFloat64FlagValue added in v1.8.17

func GetFloat64FlagValue(cmd *cobra.Command, flag string) float64

func GetIntFlagValue added in v1.8.17

func GetIntFlagValue(cmd *cobra.Command, flag string) int

func GetP added in v1.8.17

func GetP(key string, v interface{}) error

GetP fetches the value of key and returns it to v, v should be a pointer

func GetStringFlagValue added in v1.8.17

func GetStringFlagValue(cmd *cobra.Command, flag string) string

func HttpRequest

func HttpRequest(method string, url string, bodyData string) ([]byte, error)

Sends an http request and returns the body. Gives an error if the http request failed or returned a non success code.

func InvalidArgument

func InvalidArgument(arg string)

func InvalidInteger

func InvalidInteger(name string, value string, fatal bool)

func IsTTY added in v1.8.17

func IsTTY() bool

func JsonRpcCall added in v1.8.17

func JsonRpcCall(method string, params interface{}) (interface{}, error)

func JsonRpcCallAndPrint added in v1.8.17

func JsonRpcCallAndPrint(method string, params interface{})

func JsonRpcCallP added in v1.8.17

func JsonRpcCallP(method string, params interface{}, out interface{}) error

func JwtHTTPRequest added in v1.7.1

func JwtHTTPRequest(method string, url string, bodyData string) (string, error)

JwtHTTPRequest is similar to HttpRequest, but it have the content-type set as application/json and it will put the given jwt in the auth header

func MalformedUsageError added in v1.8.17

func MalformedUsageError(cmd *cobra.Command, err interface{})

func OptionListPrompt added in v1.8.17

func OptionListPrompt(msg string, options []string) int

func ParseIntToStringSlice added in v1.8.17

func ParseIntToStringSlice(vals []string) (map[int][]string, error)

func PartialCommand

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

func Prettyp added in v1.8.17

func Prettyp(s string) string

func Prettypi added in v1.8.17

func Prettypi(i interface{}) string

func Print added in v1.8.17

func Print(i interface{})

func PrintErrorFatal

func PrintErrorFatal(err interface{})

func PrintStringError

func PrintStringError(err string)

func Printf added in v1.8.17

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

func ReadTestnetStore added in v1.8.17

func ReadTestnetStore(name string, outptr interface{}) error

func RequireFlags added in v1.8.17

func RequireFlags(cmd *cobra.Command, flags ...string)

func Set added in v1.8.17

func Set(key string, value interface{}) error

Set stores a key value pair in the sql-lite database as json

func UnrollStringSliceToMapIntString added in v1.6.3

func UnrollStringSliceToMapIntString(slices []string, delim string) (map[int]string, []string, error)

func UnrollStringSliceToMapStringString added in v1.6.3

func UnrollStringSliceToMapStringString(slices []string, delim string) (map[string]string, error)

func Write

func Write(path string, data []byte) error

Write writes data to a file, creating it if it doesn't exist, deleting and recreating it if it does.

func WriteTestnetStore added in v1.8.17

func WriteTestnetStore(name string, in interface{}) error

func YesNoPrompt

func YesNoPrompt(msg string) bool

Types

type Config added in v1.8.9

type Config struct {
	APIURL            string  `mapstructure:"apiURL"`
	Verbosity         string  `mapstructure:"verbosity"`
	HTTPTimeout       int64   `mapstructure:"httpTimeout"`
	HTTPRetries       int     `mapstructure:"httpRetries"`
	StoreDirectory    string  `mapstructure:"storeDirectory"`
	ServerAddr        string  `mapstructure:"serverAddr"`
	CheckLoad         bool    `mapstructure:"checkLoad"`
	LoadWarnThreshold float64 `mapstructure:"loadWarnThreshold"`
	MaxConns          int64   `mapstructure:"maxConns"`
	RPCRetries        int     `mapstructure:"rpcRetries"`
	SSHPrivateKey     string  `mapstructure:"sshPrivateKey"`
	SSHBinary         string  `mapstructure:"sshBinary"`
}

Config groups all of the global configuration parameters into a single struct

func GetConfig added in v1.8.9

func GetConfig() *Config

GetConfig gets a pointer to the global config object. Do not modify conf object

type SshClient

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

func NewSshClient

func NewSshClient(host string) (*SshClient, error)

func (SshClient) Close

func (this SshClient) Close()

func (SshClient) GetSession

func (this SshClient) GetSession() (*ssh.Session, error)

func (SshClient) MultiRun

func (this SshClient) MultiRun(commands ...string) ([]string, error)

*

  • Easy shorthand for multiple calls to sshExec
  • @param ...string commands The commands to execute
  • @return []string The results of the execution of each command

func (SshClient) Run

func (this SshClient) Run(command string) (string, error)

Jump to

Keyboard shortcuts

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