-
Notifications
You must be signed in to change notification settings - Fork 162
/
index_reporter.go
45 lines (37 loc) · 1.23 KB
/
index_reporter.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package ui
type IndexReporter struct {
ui UI
}
func NewIndexReporter(ui UI) IndexReporter {
return IndexReporter{ui: ui}
}
func (r IndexReporter) IndexEntryStartedAdding(type_, desc string) {
r.ui.BeginLinef("Adding %s '%s'...\n", type_, desc)
}
func (r IndexReporter) IndexEntryFinishedAdding(type_, desc string, err error) {
if err != nil {
r.ui.ErrorLinef("Failed adding %s '%s'\n", type_, desc)
} else {
r.ui.BeginLinef("Added %s '%s'\n", type_, desc)
}
}
func (r IndexReporter) IndexEntryDownloadStarted(type_, desc string) {
r.ui.BeginLinef("-- Started downloading '%s' (%s)\n", type_, desc)
}
func (r IndexReporter) IndexEntryDownloadFinished(type_, desc string, err error) {
if err != nil {
r.ui.ErrorLinef("-- Failed downloading '%s' (%s)\n", type_, desc)
} else {
r.ui.BeginLinef("-- Finished downloading '%s' (%s)\n", type_, desc)
}
}
func (r IndexReporter) IndexEntryUploadStarted(type_, desc string) {
r.ui.BeginLinef("-- Started uploading '%s' (%s)\n", type_, desc)
}
func (r IndexReporter) IndexEntryUploadFinished(type_, desc string, err error) {
if err != nil {
r.ui.ErrorLinef("-- Failed uploading '%s' (%s)\n", type_, desc)
} else {
r.ui.BeginLinef("-- Finished uploading '%s' (%s)\n", type_, desc)
}
}