1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Quick run through to add some documentation comments

This commit is contained in:
Chris Cummer
2018-04-17 15:55:36 -07:00
parent ff9343d89a
commit 3175b8d9cc
16 changed files with 90 additions and 47 deletions

View File

@@ -28,7 +28,7 @@ func LoadConfigFile(filePath string) *config.Config {
cfg, err := config.ParseYamlFile(absPath)
if err != nil {
fmt.Println("\n\n\033[1m ERROR:\033[0m Could not load '\033[0;33mconfig.yml\033[0m'.\n Please add a \033[0;33mconfig.yml\033[0m file to your \033[0;33m~/.wtf\033[0m directory.\n See \033[1;34mhttps://github.com/senorprogrammer/wtf\033[0m for details.\n\n")
fmt.Println("\n\n\033[1m ERROR:\033[0m Could not load '\033[0;33mconfig.yml\033[0m'.\n Please add a \033[0;33mconfig.yml\033[0m file to your \033[0;33m~/.wtf\033[0m directory.\n See \033[1;34mhttps://github.com/senorprogrammer/wtf\033[0m for details.")
os.Exit(1)
}

View File

@@ -5,6 +5,8 @@ import (
"github.com/senorprogrammer/wtf/color"
)
// FocusTracker is used by the app to track which onscreen widget currently has focus,
// and to move focus between widgets.
type FocusTracker struct {
App *tview.Application
Idx int
@@ -13,16 +15,21 @@ type FocusTracker struct {
/* -------------------- Exported Functions -------------------- */
// Next sets the focus on the next widget in the widget list. If the current widget is
// the last widget, sets focus on the first widget.
func (tracker *FocusTracker) Next() {
tracker.blur(tracker.Idx)
tracker.increment()
tracker.focus(tracker.Idx)
}
// None removes focus from the currently-focused widget.
func (tracker *FocusTracker) None() {
tracker.blur(tracker.Idx)
}
// Prev sets the focus on the previous widget in the widget list. If the current widget is
// the last widget, sets focus on the last widget.
func (tracker *FocusTracker) Prev() {
tracker.blur(tracker.Idx)
tracker.decrement()

View File

@@ -33,7 +33,10 @@ func ExecuteCommand(cmd *exec.Cmd) string {
str += string(b)
}
cmd.Wait()
err = cmd.Wait()
if err != nil {
return fmt.Sprintf("%v\n", err)
}
return str
}