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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user