Skip to content

Commit

Permalink
added some color
Browse files Browse the repository at this point in the history
  • Loading branch information
wagoodman committed Jun 11, 2018
1 parent 3602d7d commit 23289cc
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion filetree/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package filetree
import (
"sort"
"strings"

"github.com/fatih/color"
)

type FileNode struct {
Expand Down Expand Up @@ -63,7 +65,20 @@ func (node *FileNode) Remove() error {
}

func (node *FileNode) String() string {
return node.Name
var style *color.Color
switch node.Data.DiffType {
case Added:
style = color.New(color.FgGreen)
case Removed:
style = color.New(color.FgRed)
case Changed:
style = color.New(color.FgYellow)
case Unchanged:
style = color.New(color.Reset)
default:
style = color.New(color.BgMagenta)
}
return style.Sprint(node.Name)
}

func (node *FileNode) Visit(visiter Visiter) error {
Expand Down

0 comments on commit 23289cc

Please sign in to comment.