From 23dc1c5058dce162538e5df86b279341e6cdb31d Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Sun, 13 Dec 2020 21:48:50 -0800 Subject: [PATCH] Augment with some descriptive comments Signed-off-by: Chris Cummer --- app/focus_tracker.go | 4 ++++ app/module_validator.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/app/focus_tracker.go b/app/focus_tracker.go index 03ef6965..75140484 100644 --- a/app/focus_tracker.go +++ b/app/focus_tracker.go @@ -9,6 +9,7 @@ import ( "github.com/wtfutil/wtf/wtf" ) +// FocusState is a custom type that differentiates focusable scopes type FocusState int const ( @@ -28,6 +29,7 @@ type FocusTracker struct { tviewApp *tview.Application } +// NewFocusTracker creates and returns an instance of FocusTracker func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config *config.Config) FocusTracker { focusTracker := FocusTracker{ tviewApp: tviewApp, @@ -45,6 +47,7 @@ func NewFocusTracker(tviewApp *tview.Application, widgets []wtf.Wtfable, config /* -------------------- Exported Functions -------------------- */ +// FocusOn puts the focus on the item that belongs to the focus character passed in func (tracker *FocusTracker) FocusOn(char string) bool { if !tracker.useNavShortcuts() { return false @@ -108,6 +111,7 @@ func (tracker *FocusTracker) Prev() { tracker.IsFocused = true } +// Refocus forces the focus back to the currently-selected item func (tracker *FocusTracker) Refocus() { tracker.focus(tracker.Idx) } diff --git a/app/module_validator.go b/app/module_validator.go index cee8bce2..aa20079d 100644 --- a/app/module_validator.go +++ b/app/module_validator.go @@ -9,6 +9,7 @@ import ( "github.com/wtfutil/wtf/wtf" ) +// ModuleValidator is responsible for validating the state of a module's configuration type ModuleValidator struct{} type widgetError struct { @@ -16,6 +17,7 @@ type widgetError struct { validationErrors []cfg.Validatable } +// NewModuleValidator creates and returns an instance of ModuleValidator func NewModuleValidator() *ModuleValidator { return &ModuleValidator{} }