editor

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Editor

type Editor struct {
	View   *tview.Flex
	Input  *Input
	Logger *Logger
	Output *Output
	// contains filtered or unexported fields
}

Editor implements the methods to manipulate modify editor behavior and manipulate ui elements

func NewEditor

func NewEditor() *Editor

NewEditor will return a reference to the complete editor ui used to run commands in interactive mode

func (*Editor) GetLowerPaneTitle

func (editor *Editor) GetLowerPaneTitle() string

GetLowerPaneTitle will return the title for lower pane

func (*Editor) GetUpperPaneTitle

func (editor *Editor) GetUpperPaneTitle() string

GetUpperPaneTitle will return the title for upper pane

func (*Editor) Render

func (editor *Editor) Render(app *tview.Application)

Render initializes all the ui elements and adds them to the parent container

func (*Editor) SetCommandExecFunc

func (editor *Editor) SetCommandExecFunc(fn func(string) error)

SetCommandExecFunc will set an exec function which is invoked when user presses enter key after entering the command

func (*Editor) SetErrorFunc

func (editor *Editor) SetErrorFunc(fn func(error))

SetErrorFunc will set an error function which will be invoked when there an error occurs while executing a command

func (*Editor) SetLowerPaneTitle

func (editor *Editor) SetLowerPaneTitle(title string)

SetLowerPaneTitle will set the title for lower pane. If no title is provided the pane will be rendered without title

func (*Editor) SetUpperPaneTitle

func (editor *Editor) SetUpperPaneTitle(title string)

SetUpperPaneTitle will set the title for upper pane. If no title is provided the pane will be rendered without title

type Input

type Input struct {
	*tview.InputField
	// contains filtered or unexported fields
}

Input handles all the commands entered during interactive mode

func (*Input) Done

func (i *Input) Done()

Done function emulates enter key behavior and invokes onDone callback

type Logger

type Logger struct {
	Info  *writer
	Warn  *writer
	Error *writer
	View  *tview.TextView
}

Logger provides an option to log background logs to ui

func (*Logger) ClearLogger

func (l *Logger) ClearLogger()

ClearLogger will clear all data from logger pane

func (*Logger) SetPrimary added in v0.1.1

func (l *Logger) SetPrimary(w io.Writer)

SetPrimary sets the primary writer for logger

func (*Logger) SetPrimaryAvailable added in v0.1.1

func (l *Logger) SetPrimaryAvailable(state bool)

SetPrimaryAvailable decides if the primary writer can be used or not

func (*Logger) SetSecondary added in v0.1.1

func (l *Logger) SetSecondary(w io.Writer)

SetSecondary sets the secondary writer for logger

type Output added in v0.1.1

type Output struct {
	View *tview.TextView
	// contains filtered or unexported fields
}

func (Output) Write added in v0.1.1

func (w Output) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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