Skip to content

Commit

Permalink
feat: add console title in --debug
Browse files Browse the repository at this point in the history
  • Loading branch information
lnu authored and JanDeDobbeleer committed Jan 15, 2021
1 parent 0761c04 commit f8b28f0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/engine.go
Expand Up @@ -173,6 +173,20 @@ func (e *engine) debug() {
var segmentTimings []SegmentTiming
largestSegmentNameLength := 0
e.renderer.print("\n\x1b[1mHere are the timings of segments in your prompt:\x1b[0m\n\n")

// console title timing
start := time.Now()
consoleTitle := e.consoleTitle.getTemplateText()
duration := time.Since(start)
segmentTiming := SegmentTiming{
name: "ConsoleTitle",
nameLength: 12,
enabled: e.settings.ConsoleTitle,
stringValue: consoleTitle,
enabledDuration: 0,
stringDuration: duration,
}
segmentTimings = append(segmentTimings, segmentTiming)
// loop each segments of each blocks
for _, block := range e.settings.Blocks {
for _, segment := range block.Segments {
Expand Down Expand Up @@ -209,6 +223,7 @@ func (e *engine) debug() {
segmentTimings = append(segmentTimings, segmentTiming)
}
}

// pad the output so the tabs render correctly
largestSegmentNameLength += 7
for _, segment := range segmentTimings {
Expand Down

0 comments on commit f8b28f0

Please sign in to comment.