MCPcopy
hub / github.com/kopia/kopia / run

Method run

cli/command_notification_profile_list.go:33–69  ·  view source on GitHub ↗
(ctx context.Context, rep repo.Repository)

Source from the content-addressed store, hash-verified

31}
32
33func (c *commandNotificationProfileList) run(ctx context.Context, rep repo.Repository) error {
34 var jl jsonList
35
36 if c.jo.jsonOutput {
37 jl.begin(&c.jo)
38 defer jl.end()
39 }
40
41 profileConfigs, err := notifyprofile.ListProfiles(ctx, rep)
42 if err != nil {
43 return errors.Wrap(err, "unable to list notification profiles")
44 }
45
46 for i, pc := range profileConfigs {
47 summ := getProfileSummary(ctx, pc)
48
49 if c.jo.jsonOutput {
50 if c.raw {
51 jl.emit(pc)
52 } else {
53 jl.emit(summ)
54 }
55 } else {
56 if i > 0 {
57 c.out.printStdout("\n")
58 }
59
60 c.out.printStdout("Profile %q Type %q Minimum Severity: %v\n %v\n",
61 summ.ProfileName,
62 pc.MethodConfig.Type,
63 notification.SeverityToString[pc.MinSeverity],
64 summ.Summary)
65 }
66 }
67
68 return nil
69}
70
71func getProfileSummary(ctx context.Context, pc notifyprofile.Config) notifyprofile.Summary {
72 var summ notifyprofile.Summary

Callers

nothing calls this directly

Calls 6

beginMethod · 0.95
endMethod · 0.95
emitMethod · 0.95
ListProfilesFunction · 0.92
getProfileSummaryFunction · 0.85
printStdoutMethod · 0.80

Tested by

no test coverage detected