Skip to content

Commit

Permalink
Merge pull request #1 from simsor/master
Browse files Browse the repository at this point in the history
Fix Windows color output + add MACB tags
  • Loading branch information
nbareil authored Dec 16, 2019
2 parents ac9ee8a + 41ac38d commit 2837833
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion timeliner.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ func main() {
os.Exit(4)
}

mChar := entryType(tsEntry, tsEntry.Entry.ModificationTime, "m")
aChar := entryType(tsEntry, tsEntry.Entry.AccessTime, "a")
cChar := entryType(tsEntry, tsEntry.Entry.ChangeTime, "c")
bChar := entryType(tsEntry, tsEntry.Entry.CreationTime, "b")

macbLine := fmt.Sprintf("%s%s%s%s", mChar, aChar, cChar, bChar)

date := tsEntry.Time.Format("2006-01-02")
if date == prev.Format("2006-01-02") {
date = colorDisabled(date)
Expand All @@ -107,7 +114,14 @@ func main() {
}
}

fmt.Printf("%s %s%s%s %s\n", date, hour, min, sec, tsEntry.Entry.Name)
fmt.Fprintf(color.Output, "%s %s%s%s %s %s\n", date, hour, min, sec, macbLine, tsEntry.Entry.Name)
prev = tsEntry.Time
}
}

func entryType(entry *bodyfile.TimeStampedEntry, check time.Time, c string) string {
if entry.Time.Equal(check) {
return c
}
return "."
}

0 comments on commit 2837833

Please sign in to comment.