Documentation ¶
Index ¶
- func StatusErr(pad int) string
- func StatusOK(pad int) string
- func YNPrompt(message string, defaultValue bool) bool
- type CSVStreamWriter
- type InputField
- func (i *InputField) Draw(screen tcell.Screen)
- func (i *InputField) Focus(func(p tview.Primitive))
- func (i *InputField) GetCursorPos() int
- func (i *InputField) GetText() string
- func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (i *InputField) MouseHandler() ...
- func (i *InputField) SetChangedFunc(handler func(text string)) *InputField
- func (i *InputField) SetCursorPos(p int)
- func (i *InputField) SetFieldBackgroundColor(color tcell.Color) *InputField
- func (i *InputField) SetFieldTextColor(color tcell.Color) *InputField
- func (i *InputField) SetPlaceholderTextColor(color tcell.Color) *InputField
- func (i *InputField) SetText(text string, textColors map[int]tcell.Color, triggerChange bool) *InputField
- type JSONStreamWriter
- type MapItem
- type MapSlice
- type NullStreamWriter
- type OutputStreamWriter
- type Prompter
- type SpinnerTable
- type TableAccumulator
- func (t *TableAccumulator) Data() [][]interface{}
- func (t *TableAccumulator) Finish()
- func (t *TableAccumulator) Header() []string
- func (t *TableAccumulator) Name() string
- func (t *TableAccumulator) SetHeader(id string, headerValues []string)
- func (t *TableAccumulator) Write(data []interface{}) error
- type TableStreamWriter
- type TableView
- type TaskInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CSVStreamWriter ¶
type CSVStreamWriter struct {
// contains filtered or unexported fields
}
CSVStreamWriter writes data in CSV format.
func NewCSVStreamWriter ¶
func NewCSVStreamWriter(w io.Writer) *CSVStreamWriter
NewCSVStreamWriter creates a CSVStreamWriter.
func (*CSVStreamWriter) Finish ¶
func (c *CSVStreamWriter) Finish()
Finish is called to flush all the data.
func (*CSVStreamWriter) SetHeader ¶
func (c *CSVStreamWriter) SetHeader(id string, headerValues []string)
SetHeader is called to set the key values for each of the data values. Must be called before Write is.
func (*CSVStreamWriter) Write ¶
func (c *CSVStreamWriter) Write(data []interface{}) error
Write is called for each record of data.
type InputField ¶
InputField is a one-line box which scrolls. This is copied from https://github.com/rivo/tview/blob/e352ec01560d2efc19918e4732310255b2bb800a/inputfield.go and modified to expose cursor position and more custom event handling. The following keys can be used for navigation and editing:
- Left arrow: Move left by one character.
- Right arrow: Move right by one character.
- Home, Ctrl-A, Alt-a: Move to the beginning of the line.
- End, Ctrl-E, Alt-e: Move to the end of the line.
- Alt-left, Alt-b: Move left by one word.
- Alt-right, Alt-f: Move right by one word.
- Backspace: Delete the character before the cursor.
- Delete: Delete the character after the cursor.
- Ctrl-K: Delete from the cursor to the end of the line.
- Ctrl-W: Delete the last word before the cursor.
- Ctrl-U: Delete the entire line.
func (*InputField) Draw ¶
func (i *InputField) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*InputField) Focus ¶
func (i *InputField) Focus(func(p tview.Primitive))
Focus is called when this primitive receives focus.
func (*InputField) GetCursorPos ¶
func (i *InputField) GetCursorPos() int
GetCursorPos gets the current cursor position.
func (*InputField) GetText ¶
func (i *InputField) GetText() string
GetText returns the current text of the input field.
func (*InputField) InputHandler ¶
func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
InputHandler returns the handler for this primitive.
func (*InputField) MouseHandler ¶
func (i *InputField) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (bool, tview.Primitive)
MouseHandler returns the mouse handler for this primitive.
func (*InputField) SetChangedFunc ¶
func (i *InputField) SetChangedFunc(handler func(text string)) *InputField
SetChangedFunc sets a handler which is called whenever the text of the input field has changed. It receives the current text (after the change).
func (*InputField) SetCursorPos ¶
func (i *InputField) SetCursorPos(p int)
SetCursorPos sets the current cursor position.
func (*InputField) SetFieldBackgroundColor ¶
func (i *InputField) SetFieldBackgroundColor(color tcell.Color) *InputField
SetFieldBackgroundColor sets the background color of the input area.
func (*InputField) SetFieldTextColor ¶
func (i *InputField) SetFieldTextColor(color tcell.Color) *InputField
SetFieldTextColor sets the text color of the input area.
func (*InputField) SetPlaceholderTextColor ¶
func (i *InputField) SetPlaceholderTextColor(color tcell.Color) *InputField
SetPlaceholderTextColor sets the text color of placeholder text.
func (*InputField) SetText ¶
func (i *InputField) SetText(text string, textColors map[int]tcell.Color, triggerChange bool) *InputField
SetText sets the current text of the input field.
type JSONStreamWriter ¶
type JSONStreamWriter struct {
// contains filtered or unexported fields
}
JSONStreamWriter writes one json record per row.
func NewJSONStreamWriter ¶
func NewJSONStreamWriter(w io.Writer) *JSONStreamWriter
NewJSONStreamWriter creates a JSONStreamWriter
func (*JSONStreamWriter) Finish ¶
func (j *JSONStreamWriter) Finish()
Finish is called to flush all the data.
func (*JSONStreamWriter) SetHeader ¶
func (j *JSONStreamWriter) SetHeader(id string, headerValues []string)
SetHeader is called to set the key values for each of the data values. Must be called before Write is.
func (*JSONStreamWriter) Write ¶
func (j *JSONStreamWriter) Write(data []interface{}) error
Write is called for each record of data.
type MapSlice ¶
type MapSlice []MapItem
MapSlice is an array of items.
func (MapSlice) MarshalJSON ¶
MarshalJSON marshals the k/v array in order.
type NullStreamWriter ¶
type NullStreamWriter struct{}
NullStreamWriter reads the data but does not output it.
func (*NullStreamWriter) Finish ¶
func (*NullStreamWriter) Finish()
Finish is called to flush all the data.
func (*NullStreamWriter) SetHeader ¶
func (*NullStreamWriter) SetHeader(id string, headerValues []string)
SetHeader is called to set the key values for each of the data values. Must be called before Write is.
func (*NullStreamWriter) Write ¶
func (*NullStreamWriter) Write(data []interface{}) error
Write is called for each record of data.
type OutputStreamWriter ¶
type OutputStreamWriter interface { SetHeader(id string, headerValues []string) Write(data []interface{}) error Finish() }
OutputStreamWriter is the default interface for all output writers.
func CreateStreamWriter ¶
func CreateStreamWriter(format string, w io.Writer) OutputStreamWriter
CreateStreamWriter creates a formatted writer with the default options.
type Prompter ¶
type Prompter struct {
// contains filtered or unexported fields
}
Prompter proves a user input dialog.
func NewPrompter ¶
NewPrompter creates a Prompter with the given message, choices and defaults.
type SpinnerTable ¶
type SpinnerTable struct {
// contains filtered or unexported fields
}
SpinnerTable is view for a job run table with spinners.
func NewSpinnerTable ¶
func NewSpinnerTable() *SpinnerTable
NewSpinnerTable creates a new table with Spinners.
func (*SpinnerTable) AddTask ¶
func (s *SpinnerTable) AddTask(name string) *TaskInfo
AddTask puts a task on the display.
type TableAccumulator ¶
type TableAccumulator struct {
// contains filtered or unexported fields
}
TableAccumulator accumulates all data from the table.
func NewTableAccumulator ¶
func NewTableAccumulator() *TableAccumulator
NewTableAccumulator creates a table accumulator based on input stream.
func (*TableAccumulator) Data ¶
func (t *TableAccumulator) Data() [][]interface{}
Data returns the underlying data table as slice of slices.
func (*TableAccumulator) Finish ¶
func (t *TableAccumulator) Finish()
Finish is called when all the data has been sent. For table accumulator it's a noop.
func (*TableAccumulator) Header ¶
func (t *TableAccumulator) Header() []string
Header returns the header values as a string.
func (*TableAccumulator) Name ¶
func (t *TableAccumulator) Name() string
Name returns the table name.
func (*TableAccumulator) SetHeader ¶
func (t *TableAccumulator) SetHeader(id string, headerValues []string)
SetHeader is called to set the key values for each of the data values. Must be called before Write is.
func (*TableAccumulator) Write ¶
func (t *TableAccumulator) Write(data []interface{}) error
Write is called for each record of data.
type TableStreamWriter ¶
type TableStreamWriter struct {
// contains filtered or unexported fields
}
TableStreamWriter writer output in tabular format. It's blocking so data is only written after the table is complete.
func NewTableStreamWriter ¶
func NewTableStreamWriter(w io.Writer) *TableStreamWriter
NewTableStreamWriter creates a table writer based on input stream.
func (*TableStreamWriter) Finish ¶
func (t *TableStreamWriter) Finish()
Finish is called when all the data has been sent. In the case of the table we can now render all the values.
func (*TableStreamWriter) SetHeader ¶
func (t *TableStreamWriter) SetHeader(id string, headerValues []string)
SetHeader is called to set the key values for each of the data values. Must be called before Write is.
func (*TableStreamWriter) Write ¶
func (t *TableStreamWriter) Write(data []interface{}) error
Write is called for each record of data.