io

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BinName added in v0.6.0

func BinName() string

func FormatExampleCommands

func FormatExampleCommands(command string, examples []Example) (res string)

func GetTableWriter

func GetTableWriter() table.Writer

func Long

func Long(in string) string

Remove tabs to allow formatted multi-line descriptions in Code without cluttering the help output

func PrintJSON added in v0.21.0

func PrintJSON(v any) error

func PrintYAML added in v0.21.0

func PrintYAML(v any) error

func StreamOutput added in v0.7.0

func StreamOutput(wg *sync.WaitGroup, input io.Reader, output io.Writer)

func Verbosef added in v0.10.1

func Verbosef(verbose bool, format string, args ...interface{})

func Verboseln added in v0.10.1

func Verboseln(verbose bool, output ...interface{})

Types

type Example

type Example struct {
	Cmd  string
	Desc string
}

type Exec added in v0.7.0

type Exec interface {
	ExecuteCommand(ctx context.Context, cmdArgs []string) (int, error)
}

type HttpServer added in v0.7.0

type HttpServer interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	Handle(pattern string, handler http.Handler)
	Redirect(w http.ResponseWriter, r *http.Request, url string, code int)
	ListenAndServe(addr string, handler http.Handler) error
}

type MockExec added in v0.7.0

type MockExec struct {
	mock.Mock
}

MockExec is an autogenerated mock type for the Exec type

func NewMockExec added in v0.7.0

func NewMockExec(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockExec

NewMockExec creates a new instance of MockExec. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockExec) EXPECT added in v0.7.0

func (_m *MockExec) EXPECT() *MockExec_Expecter

func (*MockExec) ExecuteCommand added in v0.7.0

func (_mock *MockExec) ExecuteCommand(ctx context.Context, cmdArgs []string) (int, error)

ExecuteCommand provides a mock function for the type MockExec

type MockExec_ExecuteCommand_Call added in v0.7.0

type MockExec_ExecuteCommand_Call struct {
	*mock.Call
}

MockExec_ExecuteCommand_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecuteCommand'

func (*MockExec_ExecuteCommand_Call) Return added in v0.7.0

func (*MockExec_ExecuteCommand_Call) Run added in v0.7.0

func (*MockExec_ExecuteCommand_Call) RunAndReturn added in v0.7.0

func (_c *MockExec_ExecuteCommand_Call) RunAndReturn(run func(ctx context.Context, cmdArgs []string) (int, error)) *MockExec_ExecuteCommand_Call

type MockExec_Expecter added in v0.7.0

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

func (*MockExec_Expecter) ExecuteCommand added in v0.7.0

func (_e *MockExec_Expecter) ExecuteCommand(ctx interface{}, cmdArgs interface{}) *MockExec_ExecuteCommand_Call

ExecuteCommand is a helper method to define mock.On call

  • ctx context.Context
  • cmdArgs []string

type MockHttpServer added in v0.7.0

type MockHttpServer struct {
	mock.Mock
}

MockHttpServer is an autogenerated mock type for the HttpServer type

func NewMockHttpServer added in v0.7.0

func NewMockHttpServer(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockHttpServer

NewMockHttpServer creates a new instance of MockHttpServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockHttpServer) EXPECT added in v0.7.0

func (*MockHttpServer) Handle added in v0.7.0

func (_mock *MockHttpServer) Handle(pattern string, handler http.Handler)

Handle provides a mock function for the type MockHttpServer

func (*MockHttpServer) HandleFunc added in v0.7.0

func (_mock *MockHttpServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

HandleFunc provides a mock function for the type MockHttpServer

func (*MockHttpServer) ListenAndServe added in v0.7.0

func (_mock *MockHttpServer) ListenAndServe(addr string, handler http.Handler) error

ListenAndServe provides a mock function for the type MockHttpServer

func (*MockHttpServer) Redirect added in v0.7.0

func (_mock *MockHttpServer) Redirect(w http.ResponseWriter, r *http.Request, url string, code int)

Redirect provides a mock function for the type MockHttpServer

type MockHttpServer_Expecter added in v0.7.0

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

func (*MockHttpServer_Expecter) Handle added in v0.7.0

func (_e *MockHttpServer_Expecter) Handle(pattern interface{}, handler interface{}) *MockHttpServer_Handle_Call

Handle is a helper method to define mock.On call

  • pattern string
  • handler http.Handler

func (*MockHttpServer_Expecter) HandleFunc added in v0.7.0

func (_e *MockHttpServer_Expecter) HandleFunc(pattern interface{}, handler interface{}) *MockHttpServer_HandleFunc_Call

HandleFunc is a helper method to define mock.On call

  • pattern string
  • handler func(http.ResponseWriter, *http.Request)

func (*MockHttpServer_Expecter) ListenAndServe added in v0.7.0

func (_e *MockHttpServer_Expecter) ListenAndServe(addr interface{}, handler interface{}) *MockHttpServer_ListenAndServe_Call

ListenAndServe is a helper method to define mock.On call

  • addr string
  • handler http.Handler

func (*MockHttpServer_Expecter) Redirect added in v0.7.0

func (_e *MockHttpServer_Expecter) Redirect(w interface{}, r interface{}, url interface{}, code interface{}) *MockHttpServer_Redirect_Call

Redirect is a helper method to define mock.On call

  • w http.ResponseWriter
  • r *http.Request
  • url string
  • code int

type MockHttpServer_HandleFunc_Call added in v0.7.0

type MockHttpServer_HandleFunc_Call struct {
	*mock.Call
}

MockHttpServer_HandleFunc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HandleFunc'

func (*MockHttpServer_HandleFunc_Call) Return added in v0.7.0

func (*MockHttpServer_HandleFunc_Call) Run added in v0.7.0

func (*MockHttpServer_HandleFunc_Call) RunAndReturn added in v0.7.0

func (_c *MockHttpServer_HandleFunc_Call) RunAndReturn(run func(pattern string, handler func(http.ResponseWriter, *http.Request))) *MockHttpServer_HandleFunc_Call

type MockHttpServer_Handle_Call added in v0.7.0

type MockHttpServer_Handle_Call struct {
	*mock.Call
}

MockHttpServer_Handle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Handle'

func (*MockHttpServer_Handle_Call) Return added in v0.7.0

func (*MockHttpServer_Handle_Call) Run added in v0.7.0

func (_c *MockHttpServer_Handle_Call) Run(run func(pattern string, handler http.Handler)) *MockHttpServer_Handle_Call

func (*MockHttpServer_Handle_Call) RunAndReturn added in v0.7.0

func (_c *MockHttpServer_Handle_Call) RunAndReturn(run func(pattern string, handler http.Handler)) *MockHttpServer_Handle_Call

type MockHttpServer_ListenAndServe_Call added in v0.7.0

type MockHttpServer_ListenAndServe_Call struct {
	*mock.Call
}

MockHttpServer_ListenAndServe_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListenAndServe'

func (*MockHttpServer_ListenAndServe_Call) Return added in v0.7.0

func (*MockHttpServer_ListenAndServe_Call) Run added in v0.7.0

func (*MockHttpServer_ListenAndServe_Call) RunAndReturn added in v0.7.0

type MockHttpServer_Redirect_Call added in v0.7.0

type MockHttpServer_Redirect_Call struct {
	*mock.Call
}

MockHttpServer_Redirect_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Redirect'

func (*MockHttpServer_Redirect_Call) Return added in v0.7.0

func (*MockHttpServer_Redirect_Call) Run added in v0.7.0

func (*MockHttpServer_Redirect_Call) RunAndReturn added in v0.7.0

type Prompt

type Prompt struct{}

func (*Prompt) InputPrompt

func (p *Prompt) InputPrompt(prompt string) string

Prompt for non-empty user input from STDIN

type RealExec added in v0.7.0

type RealExec struct{}

func (*RealExec) ExecuteCommand added in v0.7.0

func (c *RealExec) ExecuteCommand(ctx context.Context, cmdArgs []string) (int, error)

type RealHttpServer added in v0.7.0

type RealHttpServer struct{}

func (*RealHttpServer) Handle added in v0.7.0

func (*RealHttpServer) Handle(pattern string, handler http.Handler)

func (*RealHttpServer) HandleFunc added in v0.7.0

func (*RealHttpServer) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

func (*RealHttpServer) ListenAndServe added in v0.7.0

func (*RealHttpServer) ListenAndServe(addr string, handler http.Handler) error

func (*RealHttpServer) Redirect added in v0.7.0

func (*RealHttpServer) Redirect(w http.ResponseWriter, r *http.Request, url string, code int)

Jump to

Keyboard shortcuts

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