Documentation ¶
Index ¶
- Variables
- func AttributeAnsi(col gocui.Attribute) (gocui.Attribute, termenv.Color)
- func ColorProfile() termenv.Profile
- func LoadTheme()
- func Main(remote bool)
- func StringAttributeAnsi(col string) (gocui.Attribute, termenv.Color, error)
- type BasicColor
- type Config
- type RecvConn
- type Server
- type Theme
- type View
- type Widget
- func (w *Widget) Clear()
- func (w *Widget) Connect(conn *RecvConn)
- func (w *Widget) Disconnect()
- func (w *Widget) Error(err error)
- func (w *Widget) GetName() string
- func (w *Widget) GetView() *gocui.View
- func (w *Widget) IsHidden() bool
- func (w *Widget) Keybinds(g *gocui.Gui)
- func (w *Widget) Layout(g *gocui.Gui) error
- func (w *Widget) Position() int
- func (w *Widget) Print(str string)
- type WidgetConsole
- func (wc *WidgetConsole) Clear()
- func (wc *WidgetConsole) Error(err error)
- func (wc *WidgetConsole) ExecCmd(cmd string)
- func (wc *WidgetConsole) Keybinds(g *gocui.Gui)
- func (wc *WidgetConsole) Layout(g *gocui.Gui) error
- func (wc *WidgetConsole) NextHistory() string
- func (wc *WidgetConsole) PrevHistory() string
- func (wc *WidgetConsole) Print(msg string)
- func (wc *WidgetConsole) Printf(format string, a ...interface{})
- func (wc *WidgetConsole) Println(msg string)
- type WidgetFloaty
- type WidgetPipe
- type WidgetStack
- func (ws *WidgetStack) GetFunString() string
- func (ws *WidgetStack) Keybinds(g *gocui.Gui)
- func (ws *WidgetStack) Layout(g *gocui.Gui) error
- func (ws *WidgetStack) Position() int
- func (ws *WidgetStack) Print(str string)
- func (ws *WidgetStack) SetupFun(cmd string)
- func (ws *WidgetStack) StartFun()
- func (ws *WidgetStack) StopFun()
- type Widgeter
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSuspend error cause gocui environment to suspend ErrSuspend = errors.New("suspend") )
Functions ¶
func AttributeAnsi ¶
AttributeAnsi converts gocui.Attribute to ANSI color and returns both of them
func ColorProfile ¶
ColorProfile returns color profile based on configuration
Types ¶
type BasicColor ¶
type BasicColor int
BasicColor is for termenv to be able to convert to `\033[3x;1m` or `\033[3x;2m`
func (BasicColor) Sequence ¶
func (c BasicColor) Sequence(bg bool) string
Sequence return string with ANSI code
type Config ¶
type Config struct { Server `mapstructure:"server"` Theme `mapstructure:"theme"` Views map[string]View `mapstructure:"views"` }
Config type defining configuration
type RecvConn ¶
type RecvConn struct {
// contains filtered or unexported fields
}
RecvConn struct contains channels for output and error string and error
func NewRecvConn ¶
func NewRecvConn() *RecvConn
NewRecvConn create new connection to receive output from command/function
func (*RecvConn) IsEnd ¶
func (conn *RecvConn) IsEnd() <-chan struct{}
IsEnd return ending signal. Check if it's closed to confirm if it is end.
type Theme ¶
type Theme struct { ColorSpace string `mapstructure:"color-space"` FgColor string `mapstructure:"fgcolor"` BgColor string `mapstructure:"bgcolor"` Frame string `mapstructure:"frame"` FrameSel string `mapstructure:"frame-select"` Console string `mapstructure:"console"` Popup string `mapstructure:"popup"` Error string `mapstructure:"error"` Highlight string `mapstructure:"highlight"` }
Theme configuration
type View ¶
type View struct { Position int `mapstructure:"position"` Size int `mapstructure:"size"` Job string `mapstructure:"job,omitempty"` HiLine []string `mapstructure:"hiline,omitempty"` HiWord []string `mapstructure:"hiword,omitempty"` }
View configuration
type Widget ¶
type Widget struct { FrameColor gocui.Attribute TitleColor gocui.Attribute Enabled bool // contains filtered or unexported fields }
Widget structure for GUI
type WidgetConsole ¶
type WidgetConsole struct { Widget // contains filtered or unexported fields }
WidgetConsole structure for GUI
func NewWidgetConsole ¶
func NewWidgetConsole() *WidgetConsole
NewWidgetConsole creates a widget for GUI which doesn't contribute to the layout. This type of widget is displayed on top over the layout.
func (*WidgetConsole) Clear ¶
func (wc *WidgetConsole) Clear()
Clear override to not clear the console output (this is triggered everytime new command is issued in update)
func (*WidgetConsole) Error ¶
func (wc *WidgetConsole) Error(err error)
Error print error message to the console output line (second line below prompt)
func (*WidgetConsole) ExecCmd ¶
func (wc *WidgetConsole) ExecCmd(cmd string)
ExecCmd execute command in the Console Widget
func (*WidgetConsole) Keybinds ¶
func (wc *WidgetConsole) Keybinds(g *gocui.Gui)
Keybinds for specific widget
func (*WidgetConsole) Layout ¶
func (wc *WidgetConsole) Layout(g *gocui.Gui) error
Layout setup for console widget
func (*WidgetConsole) NextHistory ¶
func (wc *WidgetConsole) NextHistory() string
NextHistory go forward in history and return command from it
func (*WidgetConsole) PrevHistory ¶
func (wc *WidgetConsole) PrevHistory() string
PrevHistory go back in history and return command from it
func (*WidgetConsole) Print ¶
func (wc *WidgetConsole) Print(msg string)
Print message to the console output line
func (*WidgetConsole) Printf ¶
func (wc *WidgetConsole) Printf(format string, a ...interface{})
Printf print formatted message to the console output line (second line below prompt)
func (*WidgetConsole) Println ¶
func (wc *WidgetConsole) Println(msg string)
Println prints message to the console output line and add new line at the end
type WidgetFloaty ¶
WidgetFloaty structure for GUI
func NewWidgetFloaty ¶
NewWidgetFloaty creates a widget for GUI which doesn't contribute to the layout. This type of widget is displayed on top over the layout.
func PopupHelpWidget ¶
func PopupHelpWidget() *WidgetFloaty
PopupHelpWidget creates a pop help widget for GUI
func (*WidgetFloaty) Keybinds ¶
func (wf *WidgetFloaty) Keybinds(g *gocui.Gui)
Keybinds for specific widget
type WidgetPipe ¶
type WidgetPipe struct { Widget // contains filtered or unexported fields }
WidgetPipe structure for pipe which can be put between widget and command
func NewWidgetPipe ¶
func NewWidgetPipe(w Widgeter) *WidgetPipe
NewWidgetPipe creates a pipe widget wich is used as a pipe between real widget and output sent to it.
func (*WidgetPipe) Error ¶
func (wp *WidgetPipe) Error(err error)
Error append an error text to the widget content
func (*WidgetPipe) Layout ¶
func (wp *WidgetPipe) Layout(g *gocui.Gui) error
Layout setup for floaty widget
func (*WidgetPipe) Print ¶
func (wp *WidgetPipe) Print(str string)
Print append a text to the widget content
type WidgetStack ¶
WidgetStack structure for GUI (widgets which are stack on each other)
func NewWidgetStack ¶
func NewWidgetStack(name string, pos int, height int, body string) *WidgetStack
NewWidgetStack creates a widget for stack GUI
func (*WidgetStack) GetFunString ¶
func (ws *WidgetStack) GetFunString() string
GetFunString return command running in this widget
func (*WidgetStack) Keybinds ¶
func (ws *WidgetStack) Keybinds(g *gocui.Gui)
Keybinds for specific widget
func (*WidgetStack) Layout ¶
func (ws *WidgetStack) Layout(g *gocui.Gui) error
Layout setup for widget
func (*WidgetStack) Position ¶
func (ws *WidgetStack) Position() int
Position returns position in the stack of widgets
func (*WidgetStack) Print ¶
func (ws *WidgetStack) Print(str string)
Print append a text to the widget content. Printed line or word will be highlighted if such word exist in `highlight` map in WidgetStack.
func (*WidgetStack) SetupFun ¶
func (ws *WidgetStack) SetupFun(cmd string)
SetupFun set function to run in interval in this widget
func (*WidgetStack) StartFun ¶
func (ws *WidgetStack) StartFun()
StartFun starts a function for the view to update it's content. Function has to return string which is used for update
func (*WidgetStack) StopFun ¶
func (ws *WidgetStack) StopFun()
StopFun stops function running to update widget
type Widgeter ¶
type Widgeter interface { // Layout is for gocui.GUI Layout(*gocui.Gui) error Keybinds(*gocui.Gui) GetName() string GetView() *gocui.View IsHidden() bool Position() int Connect(conn *RecvConn) Disconnect() Clear() Print(str string) Error(err error) }
Widgeter cover Layout for GUI and some specifics for widgets