MCPcopy Create free account
hub / github.com/boostorg/json / main

Function main

example/pretty.cpp:128–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128int
129main(int argc, char** argv)
130{
131 if(argc != 2)
132 {
133 std::cerr <<
134 "Usage: pretty <filename>"
135 << std::endl;
136 return EXIT_FAILURE;
137 }
138
139 try
140 {
141 // Parse the file as JSON
142 auto const jv = parse_file( argv[1] );
143
144 // Now pretty-print the value
145 pretty_print(std::cout, jv);
146 }
147 catch(std::exception const& e)
148 {
149 std::cerr <<
150 "Caught exception: "
151 << e.what() << std::endl;
152 return EXIT_FAILURE;
153 }
154
155 return EXIT_SUCCESS;
156}
157
158// end::example_pretty[]

Callers

nothing calls this directly

Calls 3

parse_fileFunction · 0.85
pretty_printFunction · 0.85
whatMethod · 0.45

Tested by

no test coverage detected