examples/cmake/main.cpp
raw| 1 | #include <iostream> |
| 2 | #include <string> |
| 3 | #include <libjsonnet++.h> |
| 4 | |
| 5 | int main(int argc, char **argv) { |
| 6 | jsonnet::Jsonnet vm; |
| 7 | vm.init(); |
| 8 | std::string code = "local c=3;{a:1,b:2,c:c}"; |
| 9 | std::string output; |
| 10 | std::cout << "evaluating " << code << std::endl; |
| 11 | if (vm.evaluateSnippet("-", code, &output)) { |
| 12 | std::cout << "result:\n" << output << std::endl; |
| 13 | return 0; |
| 14 | } else { |
| 15 | std::cout << "FAILURE:\n" << vm.lastError() << std::endl; |
| 16 | return 1; |
| 17 | } |
| 18 | } |