cli

package
v19.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2019 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitOnErrorWithMessage

func ExitOnErrorWithMessage(exitcode ExitCode.Enum, msg string) error

ExitOnErrorWithMessage informs cli to exit with message and error code

func ExitOnInvalidArgument

func ExitOnInvalidArgument(msg string) error

ExitOnInvalidArgument ...

func ExitOnInvalidOption

func ExitOnInvalidOption(msg string) error

ExitOnInvalidOption ...

func ExitOnNotFound

func ExitOnNotFound(msg string) error

ExitOnNotFound ...

func ExitOnRPC

func ExitOnRPC(msg string) error

ExitOnRPC ...

func ExtractRetCode

func ExtractRetCode(err error) (string, int, error)

ExtractRetCode extracts info from the error

func FailureResponse

func FailureResponse(err error) error

FailureResponse ...

func ParseParameter

func ParseParameter(request string) (map[string]*Token, error)

ParseParameter transforms a string to a list of tokens

func SuccessResponse

func SuccessResponse(result interface{}) error

SuccessResponse ...

func UserConfirmed

func UserConfirmed(msg string) bool

UserConfirmed asks user to confirm

Types

type Token

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

Token describes a token (<keyword> <operator> <value>)

func NewToken

func NewToken() *Token

NewToken creates a new token

func (*Token) GetKeyword

func (t *Token) GetKeyword() (string, error)

GetKeyword returns the keyword member of the token (pos == 0)

func (*Token) GetOperator

func (t *Token) GetOperator() (string, error)

GetOperator returns the operator member of the token (pos == 1)

func (*Token) GetValue

func (t *Token) GetValue() (string, error)

GetValue returns the value member of the token (pos == 2)

func (*Token) IsFull

func (t *Token) IsFull() bool

IsFull tells if the token is full

func (*Token) Push

func (t *Token) Push(item string) error

Push sets an item of the token based on its current content

func (*Token) String

func (t *Token) String() string

String returns a string representing the token

func (*Token) Validate

func (t *Token) Validate() (string, string, error)

Validate validates value in relation with operator, and returns min and max values if validated

Directories

Path Synopsis
enums

Jump to

Keyboard shortcuts

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