<commit_before>#include <fstream>
#include <iostream>
#include <iterator>
#include <map>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

#include <boost/algorithm/string/split.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/map.hpp>

#include <boost/config/select_platform_config.hpp>

namespace po = boost::program_options;

typedef std::map<std::string, std::string> MapAlias;

std::string getStorageFile()
{
    boost::filesystem::path path;
    path = std::getenv(BOOST_WINDOWS ? "HOMEPATH" :  "HOME");
    path /= ".kd_database";
    return path.string();
}

// add a new alias or throw in case it already exists.
void add(const std::string& alias, const std::string& path, MapAlias& map_alias)
{
    auto it = map_alias.find(alias);

    if (it != map_alias.end())
        throw(std::runtime_error("alias already exists!"));

    map_alias[alias] = path;
}

// remove an alias or throw in the case it doesn't exist.<commit_msg>implemented to save the aliases inside a file located in the $HOME directory.<commit_after>#include <fstream>
#include <iostream>
#include <iterator>
#include <map>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>

#include <boost/algorithm/string/split.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/map.hpp>

#include <boost/config/select_platform_config.hpp>

namespace po = boost::program_options;

typedef std::map<std::string, std::string> MapAlias;


std::string getStorageFile()
{
    boost::filesystem::path path;
    path = std::getenv(BOOST_WINDOWS ? "HOMEPATH" :  "HOME");
    path /= ".kd_database";
    return path.string();
}

// add a new alias or throw in case it already exists.
void add(const std::string& alias, const std::string& path, MapAlias& map_alias)
{
    auto it = map_alias.find(alias);

    if (it != map_alias.end())
        throw(std::runtime_error("alias already exists!"));

    map_alias[alias] = path;
}

// remove an alias or throw in the case it doesn't exist.
{'fraction_non_alphanumeric': 0.1418319966230477, 'fraction_numerical': 0.0, 'mean_word_length': 5.092544987146529, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1620249', 'n_tokens_mistral': 784, 'n_tokens_neox': 774, 'n_words': 197}