Skip to content

Commit e7fa99b

Browse files
author
vilmibm
committed
share annotation printing
1 parent 43ab74a commit e7fa99b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

pkg/cmd/run/shared/presentation.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,14 @@ func RenderJobs(cs *iostreams.ColorScheme, jobs []Job, verbose bool) string {
3636

3737
return strings.Join(lines, "\n")
3838
}
39+
40+
func RenderAnnotations(cs *iostreams.ColorScheme, annotations []Annotation) string {
41+
lines := []string{}
42+
43+
for _, a := range annotations {
44+
lines = append(lines, fmt.Sprintf("%s %s", AnnotationSymbol(cs, a), a.Message))
45+
lines = append(lines, cs.Grayf("%s: %s#%d\n", a.JobName, a.Path, a.StartLine))
46+
}
47+
48+
return strings.Join(lines, "\n")
49+
}

pkg/cmd/run/view/view.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,8 @@ func runView(opts *ViewOptions) error {
164164
if len(annotations) > 0 {
165165
fmt.Fprintln(out)
166166
fmt.Fprintln(out, cs.Bold("ANNOTATIONS"))
167+
fmt.Fprintln(out, shared.RenderAnnotations(cs, annotations))
167168

168-
for _, a := range annotations {
169-
fmt.Fprintf(out, "%s %s\n", shared.AnnotationSymbol(cs, a), a.Message)
170-
fmt.Fprintln(out, cs.Grayf("%s: %s#%d\n",
171-
a.JobName, a.Path, a.StartLine))
172-
}
173169
}
174170

175171
fmt.Fprintln(out)

0 commit comments

Comments
 (0)