Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/utility/dump_versioned_json.cpp
blob: 24ef482f11305a27f1842905e4d9d510c9be775d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "StarFile.hpp"
#include "StarVersioningDatabase.hpp"

using namespace Star;

int main(int argc, char** argv) {
  try {
    if (argc != 3) {
      coutf("Usage, {} <versioned_json_binary> <versioned_json_json>\n", argv[0]);
      return -1;
    }

    auto versionedJson = VersionedJson::readFile(argv[1]);
    File::writeFile(versionedJson.toJson().printJson(2), argv[2]);
    return 0;
  } catch (std::exception const& e) {
    coutf("Error! Caught exception {}\n", outputException(e, true));
    return 1;
  }
}