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

Split up logger and widget

This allows us to use the logger from the wtf directory
For example when trying to debug sort ordering in focus_tracker
This commit is contained in:
Sean Smith
2019-05-10 18:21:52 -04:00
parent 0b59a3b62f
commit c328ba4c11
12 changed files with 131 additions and 117 deletions

View File

@@ -14,6 +14,7 @@ import (
"github.com/alecthomas/chroma/styles"
"github.com/radovskyb/watcher"
"github.com/rivo/tview"
"github.com/wtfutil/wtf/utils"
"github.com/wtfutil/wtf/wtf"
)
@@ -98,7 +99,7 @@ func (widget *Widget) fileName() string {
}
func (widget *Widget) formattedText() string {
filePath, _ := wtf.ExpandHomeDir(widget.CurrentSource())
filePath, _ := utils.ExpandHomeDir(widget.CurrentSource())
file, err := os.Open(filePath)
if err != nil {
@@ -129,7 +130,7 @@ func (widget *Widget) formattedText() string {
}
func (widget *Widget) plainText() string {
filePath, _ := wtf.ExpandHomeDir(widget.CurrentSource())
filePath, _ := utils.ExpandHomeDir(widget.CurrentSource())
fmt.Println(filePath)
@@ -159,7 +160,7 @@ func (widget *Widget) watchForFileChanges() {
// Watch each textfile for changes
for _, source := range widget.Sources {
fullPath, err := wtf.ExpandHomeDir(source)
fullPath, err := utils.ExpandHomeDir(source)
if err == nil {
if err := watch.Add(fullPath); err != nil {
log.Fatalln(err)