arpicee

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingFormatString = errors.New("failed to format response: object missing a formatString")

Functions

func Equal

func Equal(expected, is RemoteCall) bool

func Output

func Output(res map[string]interface{}, outputFormat string) (string, error)

func OutputFormat

func OutputFormat(args []Argument) string

func ValidateArguments

func ValidateArguments(args []Argument, params []Parameter) error

Types

type Argument

type Argument interface {
	// contains filtered or unexported methods
}

func ArgsFromFlags

func ArgsFromFlags(params []Parameter, flags []string) ([]Argument, string, error)

func GetArg

func GetArg(args []Argument, name string) Argument

type ArgumentBool

type ArgumentBool struct {
	Name string
	Val  bool
}

type ArgumentInt

type ArgumentInt struct {
	Name string
	Val  int
}

type ArgumentString

type ArgumentString struct {
	Name string
	Val  string
}

type ParamType

type ParamType int
const (
	TypeBool ParamType = iota
	TypeInt
	TypeString
)

type Parameter

type Parameter struct {
	Name        string
	Type        ParamType
	Description string
	Required    bool
}

type RemoteCall

type RemoteCall interface {
	Name() string
	Description() string
	Params() []Parameter

	Run(args []Argument) (map[string]interface{}, error)
}

Jump to

Keyboard shortcuts

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