formatter

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package formatter is a generated GoMock package.

Package formatter provides the formatter for the spotlike.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Blue is a proxy of fatih/color.Blue.
	Blue = color.New(color.FgBlue).SprintFunc()
	// Green is a proxy of fatih/color.Green.
	Green = color.New(color.FgGreen).SprintFunc()
	// Red is a proxy of fatih/color.Red.
	Red = color.New(color.FgRed).SprintFunc()
	// Yellow is a proxy of fatih/color.Yellow.
	Yellow = color.New(color.FgYellow).SprintFunc()
)
View Source
var (
	// Tu is a variable to store the table writer with the default values for injecting the dependencies in testing.
	Tu = utility.NewTableWriterUtil(proxy.NewTableWriter())
)

Functions

func AppendErrorToOutput

func AppendErrorToOutput(err error, output string) string

AppendErrorToOutput appends an error to the output.

Types

type Formatter

type Formatter interface {
	Format(result any) (string, error)
}

Formatter is an interface that formats the output of spotlike cli.

type MockFormatter

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

MockFormatter is a mock of Formatter interface.

func NewMockFormatter

func NewMockFormatter(ctrl *gomock.Controller) *MockFormatter

NewMockFormatter creates a new mock instance.

func (*MockFormatter) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockFormatter) Format

func (m *MockFormatter) Format(result any) (string, error)

Format mocks base method.

type MockFormatterMockRecorder

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

MockFormatterMockRecorder is the mock recorder for MockFormatter.

func (*MockFormatterMockRecorder) Format

func (mr *MockFormatterMockRecorder) Format(result any) *gomock.Call

Format indicates an expected call of Format.

type NewFormatterFunc

type NewFormatterFunc func(format string) (Formatter, error)

NewFormatterFunc is a function type that defines the signature for creating a new Formatter.

var NewFormatter NewFormatterFunc = func(format string) (Formatter, error) {
	var f Formatter
	switch format {
	case "plain":
		f = NewPlainFormatter()
	case "table":
		f = NewTableFormatter()
	default:
		return nil, errors.New("invalid format")
	}
	return f, nil
}

NewFormatter is a function that returns a new instance of the Formatter interface.

type PlainFormatter

type PlainFormatter struct{}

PlainFormatter is a struct that formats the output of spotlike cli.

func NewPlainFormatter

func NewPlainFormatter() *PlainFormatter

NewPlainFormatter returns a new instance of the PlainFormatter struct.

func (*PlainFormatter) Format

func (f *PlainFormatter) Format(result any) (string, error)

Format formats the output of spotlike cli.

type TableFormatter

type TableFormatter struct{}

TableFormatter is a struct that formats the output of spotlike cli.

func NewTableFormatter

func NewTableFormatter() *TableFormatter

NewTableFormatter returns a new instance of the TableFormatter struct.

func (*TableFormatter) Format

func (f *TableFormatter) Format(result any) (string, error)

Format formats the output of spotlike cli.

Jump to

Keyboard shortcuts

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