File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,6 +162,14 @@ type FileDetail struct {
162162 Status string
163163}
164164
165+ func (f * FileDetail ) ShortenSourceFile (n int ) string {
166+ x := len (f .SourceFile ) - n
167+ if x <= 0 {
168+ return f .SourceFile
169+ }
170+ return fmt .Sprintf ("..%s" , f .SourceFile [x :])
171+ }
172+
165173// SortEpochs returns timeline keys sorted by epoch
166174func (f * FileDetail ) SortEpochs () []int64 {
167175 keys := []int64 {}
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const (
3434 {{- if $f.IsTerminal }}
3535 {{- FormatDuration $f.TimeSpent | printf "\n%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] Terminal
3636 {{- else }}
37- {{- FormatDuration $f.TimeSpent | printf "\n%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] {{$f.SourceFile }}
37+ {{- FormatDuration $f.TimeSpent | printf "\n%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] {{$f.ShortenSourceFile 40 }}
3838 {{- end }}
3939 {{- end }}
4040 {{- if len .Note.Files }}
@@ -52,7 +52,7 @@ const (
5252 {{- if $f.IsTerminal }}
5353 {{- FormatDuration $f.TimeSpent | printf "%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] Terminal
5454 {{- else }}
55- {{- FormatDuration $f.TimeSpent | printf "%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] {{$f.SourceFile }}
55+ {{- FormatDuration $f.TimeSpent | printf "%14s" }} {{ Percent $f.TimeSpent $total | printf "%3.0f"}}% [{{ $f.Status }}] {{$f.ShortenSourceFile 40 }}
5656 {{- end }}
5757{{ end }}
5858{{- if len .Note.Files }}
You can’t perform that action at this time.
0 commit comments