MCPcopy Create free account
hub / github.com/MG-RAST/Shock / exitOutput

Function exitOutput

shock-client/util.go:46–67  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

44}
45
46func exitOutput(v interface{}) {
47 var b []byte
48 var e error
49 if pretty {
50 b, e = json.MarshalIndent(v, "", " ")
51 } else {
52 b, e = json.Marshal(v)
53 }
54 if e != nil {
55 exitError(e.Error())
56 }
57 if (output == "") || (output == "-") || (output == "stdout") {
58 fmt.Println(string(b))
59 } else {
60 b = append(b, '\n')
61 e = ioutil.WriteFile(output, b, 0644)
62 if e != nil {
63 exitError(e.Error())
64 }
65 }
66 os.Exit(0)
67}
68
69func getUserInfo() (host string, auth string) {
70 // set from env if exists

Callers 1

mainFunction · 0.85

Calls 2

exitErrorFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected