<commit_before>// Copyright 2015 <NAME>

#include "ArgParser.h"
#include <iostream>
#include <string>

ArgParser::ArgParser(int argc, const char *const argv[]) {
  namespace po = boost::program_options;
  po::options_description general_options("General options");

  std::string config;

  general_options.add_options()
      ("help,h", "produce this help message")
      ("store,s", "save file hashes")
      ("check,c", "check file hashes")
      ("config", po::value<std::string>(&config)->default_value("config.ini"), "config file location");

  try {
    po::store(po::command_line_parser(argc, argv).options(general_options).run(), vm);
    ArgParser::conflictingOptions(vm, "store", "check");
    if (vm.count("store")) {
      mode = STORE;
    } else if (vm.count("check")) {
      mode = CHECK;
    } else {
      std::cout << general_options;
    }

    po::notify(vm);
  } catch (std::exception &e) {
    std::cerr << e.what() << std::endl << general_options;
  }
}

void ArgParser::conflictingOptions(const boost::program_options::variables_map &vm, const std::string &opt1,
                                   const std::string &opt2) {
  if (vm.count(opt1) && !vm[opt1].defaulted() &&
      vm.count(opt2) && !vm[opt2].defaulted()) {
    throw std::logic_error(std::string("Conflicting options '") + opt1 + "' and '" + opt2 + "'.");
  }
}

std::string ArgParser::GetConfigFile() {
  return vm["config"].as<std::string>();
}<commit_msg>Changed .ini to .json<commit_after>// Copyright 2015 <NAME>

#include "ArgParser.h"
#include <iostream>
#include <string>

ArgParser::ArgParser(int argc, const char *const argv[]) {
  namespace po = boost::program_options;
  po::options_description general_options("General options");

  std::string config;

  general_options.add_options()
      ("help,h", "produce this help message")
      ("store,s", "save file hashes")
      ("check,c", "check file hashes")
      ("config", po::value<std::string>(&config)->default_value("config.json"), "config file location");

  try {
    po::store(po::command_line_parser(argc, argv).options(general_options).run(), vm);
    ArgParser::conflictingOptions(vm, "store", "check");
    if (vm.count("store")) {
      mode = STORE;
    } else if (vm.count("check")) {
      mode = CHECK;
    } else {
      std::cout << general_options;
    }

    po::notify(vm);
  } catch (std::exception &e) {
    std::cerr << e.what() << std::endl << general_options;
  }
}

void ArgParser::conflictingOptions(const boost::program_options::variables_map &vm, const std::string &opt1,
                                   const std::string &opt2) {
  if (vm.count(opt1) && !vm[opt1].defaulted() &&
      vm.count(opt2) && !vm[opt2].defaulted()) {
    throw std::logic_error(std::string("Conflicting options '") + opt1 + "' and '" + opt2 + "'.");
  }
}

std::string ArgParser::GetConfigFile() {
  return vm["config"].as<std::string>();
}
{'fraction_non_alphanumeric': 0.18563080096253007, 'fraction_numerical': 0.008250257820556892, 'mean_word_length': 3.898989898989899, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3553359', 'n_tokens_mistral': 962, 'n_tokens_neox': 940, 'n_words': 193}