MCPcopy Index your code
hub / github.com/kopia/kopia / run

Method run

cli/command_notification_template_list.go:26–65  ·  view source on GitHub ↗
(ctx context.Context, rep repo.Repository)

Source from the content-addressed store, hash-verified

24}
25
26func (c *commandNotificationTemplateList) run(ctx context.Context, rep repo.Repository) error {
27 infos, err := notifytemplate.ListTemplates(ctx, rep, "")
28 if err != nil {
29 return errors.Wrap(err, "error listing templates")
30 }
31
32 sort.Slice(infos, func(i, j int) bool {
33 return infos[i].Name < infos[j].Name
34 })
35
36 var jl jsonList
37
38 if c.jo.jsonOutput {
39 jl.begin(&c.jo)
40 defer jl.end()
41 }
42
43 c.out.printStdout("%-30v %-15v %v\n", "NAME", "TYPE", "MODIFIED")
44
45 for _, i := range infos {
46 if c.jo.jsonOutput {
47 jl.emit(i)
48 continue
49 }
50
51 var typeString, lastModString string
52
53 if i.LastModified == nil {
54 typeString = "<built-in>"
55 lastModString = ""
56 } else {
57 typeString = "<customized>"
58 lastModString = formatTimestamp(*i.LastModified)
59 }
60
61 c.out.printStdout("%-30v %-15v %v\n", i.Name, typeString, lastModString)
62 }
63
64 return nil
65}

Callers

nothing calls this directly

Calls 6

beginMethod · 0.95
endMethod · 0.95
emitMethod · 0.95
ListTemplatesFunction · 0.92
formatTimestampFunction · 0.85
printStdoutMethod · 0.80

Tested by

no test coverage detected