Documentation
¶
Index ¶
- func FuzzyMultiSelector(question string, items []string, stdin io.Reader, terminal TerminalInterface) []string
- func FuzzySelector(question string, items []string, stdin io.Reader, terminal TerminalInterface) string
- func FuzzyTableMultiSelector(question string, columns []string, items [][]string, stdin io.Reader, ...) [][]string
- func FuzzyTableSelector(question string, columns []string, items [][]string, stdin io.Reader, ...) []string
- func MultiInput(fields []InputField, stdin io.Reader, terminal TerminalInterface) []string
- func Question(question string, blankAcceptable bool, bufferedStdin stringReader, ...) string
- type InputField
- type MockTerminal
- func (m *MockTerminal) BufferInputs() bool
- func (m *MockTerminal) Clear()
- func (m *MockTerminal) Flush()
- func (m *MockTerminal) Height() int
- func (m *MockTerminal) MakeRaw() error
- func (m *MockTerminal) Print(items ...interface{}) (int, error)
- func (m *MockTerminal) Println(items ...interface{}) (int, error)
- func (m *MockTerminal) SignalInterrupt()
- func (m *MockTerminal) Sync(s string) error
- func (m *MockTerminal) Unraw() error
- func (m *MockTerminal) Width() int
- type StdinDripFeeder
- type TerminalInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FuzzyMultiSelector ¶
func FuzzyMultiSelector(question string, items []string, stdin io.Reader, terminal TerminalInterface) []string
FuzzyMultiSelector is used to create a selector with multiple items.
func FuzzySelector ¶
func FuzzySelector(question string, items []string, stdin io.Reader, terminal TerminalInterface) string
FuzzySelector is used to create a selector. If terminal is nil, we will default to goterm.
func FuzzyTableMultiSelector ¶
func FuzzyTableMultiSelector(question string, columns []string, items [][]string, stdin io.Reader, terminal TerminalInterface) [][]string
FuzzyTableMultiSelector is used to create a selector with a table and multiple items.
func FuzzyTableSelector ¶
func FuzzyTableSelector(question string, columns []string, items [][]string, stdin io.Reader, terminal TerminalInterface) []string
FuzzyTableSelector is used to create a selector with a table.
func MultiInput ¶
func MultiInput(fields []InputField, stdin io.Reader, terminal TerminalInterface) []string
MultiInput is used to format multiple input slots to the display.
Types ¶
type InputField ¶
type InputField struct { // Optional defines if the field can be blank. Optional bool `json:"optional"` // Name defines the input boxes name. Name string `json:"name"` // Description defines the input boxes description. Description string `json:"description"` }
InputField is used to define a field which users can input text into.
type MockTerminal ¶
MockTerminal is used to define a terminal mock for unit tests.
func (*MockTerminal) BufferInputs ¶
func (m *MockTerminal) BufferInputs() bool
BufferInputs implements TerminalInterface.
func (*MockTerminal) Height ¶
func (m *MockTerminal) Height() int
Height implements TerminalInterface.
func (*MockTerminal) MakeRaw ¶
func (m *MockTerminal) MakeRaw() error
MakeRaw implements TerminalInterface.
func (*MockTerminal) Print ¶
func (m *MockTerminal) Print(items ...interface{}) (int, error)
Print implements TerminalInterface.
func (*MockTerminal) Println ¶
func (m *MockTerminal) Println(items ...interface{}) (int, error)
Println implements TerminalInterface.
func (*MockTerminal) SignalInterrupt ¶
func (m *MockTerminal) SignalInterrupt()
SignalInterrupt implements TerminalInterface.
func (*MockTerminal) Sync ¶
func (m *MockTerminal) Sync(s string) error
Sync implements TerminalInterface.
func (*MockTerminal) Unraw ¶
func (m *MockTerminal) Unraw() error
Unraw implements TerminalInterface.
type StdinDripFeeder ¶
StdinDripFeeder is used to define a io.Reader designed to drip feed in different inputs.
type TerminalInterface ¶
type TerminalInterface interface { Height() int Width() int Print(items ...interface{}) (int, error) Sync(s string) error Println(items ...interface{}) (int, error) Clear() Flush() SignalInterrupt() MakeRaw() error Unraw() error BufferInputs() bool }
TerminalInterface defines a interface for a compatible terminal. Used for unit testing.