result

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	Error     string `json:"error,omitempty"`         // hand written error message
	Details   string `json:"error_details,omitempty"` // underlying error message
	ErrorCode string `json:"code,omitempty"`          // machine-keyable error code
	Success   string `json:"success,omitempty"`       // hand written success message

	Serializable any   `json:"-"` // wholesale output if mode is JSON
	ExitStatus   uint8 `json:"-"` // process exit status code. keeping hidden since it's not always present

	SuccessMultiline bool `json:"-"` // success message is multi-line, disable automatic colors
	ErrorMultiline   bool `json:"-"` // error message is multi-line, disable automatic colors
}

Returned by command functions

func NewError

func NewError(err string, code string) *Response

func NewErrorWithDetails

func NewErrorWithDetails(err string, code string, details error) *Response

func NewSerializable

func NewSerializable(success string, serializable any) *Response

func NewSuccess

func NewSuccess(success string) *Response

func (*Response) AddErrorLn

func (r *Response) AddErrorLn(line string)

func (*Response) AddSuccessLn

func (r *Response) AddSuccessLn(line string)

func (Response) Display

func (r Response) Display(encode bool) error

func (*Response) SetError

func (r *Response) SetError(err string, code string)

func (*Response) SetErrorDetails

func (r *Response) SetErrorDetails(details error)

Jump to

Keyboard shortcuts

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