MCPcopy
hub / github.com/davyxu/tabtoy / Run

Method Run

v2/printer/json.go:26–54  ·  view source on GitHub ↗
(g *Globals)

Source from the content-addressed store, hash-verified

24}
25
26func (self *jsonPrinter) Run(g *Globals) *Stream {
27
28 bf := NewStream()
29 bf.Printf("{\n")
30
31 bf.Printf(" \"Tool\": \"github.com/davyxu/tabtoy\",\n")
32 bf.Printf(" \"Version\": \"%s\",\n", g.Version)
33
34 for tabIndex, tab := range g.Tables {
35
36 if !tab.LocalFD.MatchTag(".json") {
37 log.Infof("%s: %s", i18n.String(i18n.Printer_IgnoredByOutputTag), tab.Name())
38 continue
39 }
40
41 if tabIndex > 0 {
42 bf.Printf(", \n")
43 }
44
45 if !printTableJson(bf, tab) {
46 return nil
47 }
48
49 }
50
51 bf.Printf("}")
52
53 return bf
54}
55
56func printTableJson(bf *Stream, tab *model.Table) bool {
57

Callers

nothing calls this directly

Calls 6

PrintfMethod · 0.95
StringFunction · 0.92
NewStreamFunction · 0.85
printTableJsonFunction · 0.85
MatchTagMethod · 0.80
NameMethod · 0.65

Tested by

no test coverage detected