MCPcopy Create free account
hub / github.com/entireio/git-sync / printOutput

Function printOutput

cmd/git-sync/root.go:45–59  ·  view source on GitHub ↗
(jsonOutput bool, value interface{ Lines() []string })

Source from the content-addressed store, hash-verified

43}
44
45func printOutput(jsonOutput bool, value interface{ Lines() []string }) {
46 if jsonOutput {
47 data, err := marshalOutput(value)
48 if err != nil {
49 fmt.Fprintf(os.Stderr, "error: encode JSON output: %v\n", err)
50 os.Exit(1)
51 }
52 fmt.Println(string(data))
53 return
54 }
55
56 for _, line := range value.Lines() {
57 fmt.Println(line)
58 }
59}
60
61func marshalOutput(value interface{}) ([]byte, error) {
62 data, err := json.MarshalIndent(value, "", " ")

Callers 5

newSyncLikeCmdFunction · 0.85
newProbeCmdFunction · 0.85
newFetchCmdFunction · 0.85
newBootstrapCmdFunction · 0.85
newConvertSHA256CmdFunction · 0.85

Calls 2

marshalOutputFunction · 0.85
LinesMethod · 0.45

Tested by

no test coverage detected