Documentation ¶
Index ¶
- Variables
- type Binding
- type Gui
- func (gui *Gui) GenerateSentinelErrors()
- func (gui *Gui) GetColor(keys []string) gocui.Attribute
- func (gui *Gui) GetInitialKeybindings() []*Binding
- func (gui *Gui) GetOptionsPanelTextColor() (gocui.Attribute, error)
- func (gui *Gui) Run() error
- func (gui *Gui) RunWithSubprocesses() error
- func (gui *Gui) SetColorScheme() error
- func (gui *Gui) WithWaitingStatus(name string, f func() error) error
- type SentinelErrors
Constants ¶
This section is empty.
Variables ¶
var OverlappingEdges = false
OverlappingEdges determines if panel edges overlap
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct { ViewName string Handler func(*gocui.Gui, *gocui.View) error Key interface{} // FIXME: find out how to get `gocui.Key | rune` Modifier gocui.Modifier Description string }
Binding - a keybinding mapping a key and modifier to a handler. The keypress is only handled if the given view has focus, or handled globally if the view is ""
func (*Binding) GetDisplayStrings ¶
GetDisplayStrings returns the display string of a file
type Gui ¶
type Gui struct { Log *logrus.Entry DockerCommand *commands.DockerCommand OSCommand *commands.OSCommand SubProcess *exec.Cmd State guiState Config *config.AppConfig Tr *i18n.TranslationSet Errors SentinelErrors T *tasks.TaskManager ErrorChan chan error CyclableViews []string // contains filtered or unexported fields }
Gui wraps the gocui Gui object which handles rendering and events
func NewGui ¶
func NewGui(log *logrus.Entry, dockerCommand *commands.DockerCommand, oSCommand *commands.OSCommand, tr *i18n.TranslationSet, config *config.AppConfig, errorChan chan error) (*Gui, error)
NewGui builds a new gui handler
func (*Gui) GenerateSentinelErrors ¶
func (gui *Gui) GenerateSentinelErrors()
GenerateSentinelErrors makes the sentinel errors for the gui. We're defining it here because we can't do package-scoped errors with localization, and also because it seems like package-scoped variables are bad in general https://dave.cheney.net/2017/06/11/go-without-package-scoped-variables In the future it would be good to implement some of the recommendations of that article. For now, if we don't need an error to be a sentinel, we will just define it inline. This has implications for error messages that pop up everywhere in that we'll be duplicating the default values. We may need to look at having a default localisation bundle defined, and just using keys-only when localising things in the code.
func (*Gui) GetInitialKeybindings ¶
GetInitialKeybindings is a function.
func (*Gui) GetOptionsPanelTextColor ¶
GetOptionsPanelTextColor gets the color of the options panel text
func (*Gui) RunWithSubprocesses ¶
RunWithSubprocesses loops, instantiating a new gocui.Gui with each iteration if the error returned from a run is a ErrSubProcess, it runs the subprocess otherwise it handles the error, possibly by quitting the application
func (*Gui) SetColorScheme ¶
SetColorScheme sets the color scheme for the app based on the user config