<commit_before>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <iostream>

#include "storage/StorageImpl.h"
#include "storage/Environment.h"
#include "storage/Devicegraph.h"
#include "storage/Utils/SystemCmd.h"
#include "storage/Utils/Logger.h"


using namespace std;
using namespace storage;


void
doit()
{
    set_logger(get_logfile_logger());

    Environment environment(true, ProbeMode::READ_DEVICEGRAPH, TargetMode::DIRECT);

    environment.set_devicegraph_filename("devicegraph.xml");

    Storage storage(environment);

    const Devicegraph* probed = storage.get_probed();

    cout << *probed << endl;

    const TmpDir& tmp_dir = storage.get_impl().get_tmp_dir();

    probed->write_graphviz(tmp_dir.get_fullname() + "/display.gv", GraphvizFlags::CLASSNAME |
			   GraphvizFlags::SID | GraphvizFlags::SIZE);
    system(string("dot -Tsvg < " + quote(tmp_dir.get_fullname() + "/display.gv") + " > " +
		  quote(tmp_dir.get_fullname() + "/display.svg")).c_str());
    unlink(string(tmp_dir.get_fullname() + "/display.gv").c_str());
    system(string("display " + quote(tmp_dir.get_fullname() + "/display.svg")).c_str());
    unlink(string(tmp_dir.get_fullname() + "/display.svg").c_str());
}


void usage() __attribute__ ((__noreturn__));

void
usage()
{
    cerr << "display" << endl;
    exit(EXIT_FAILURE);
}


int
main(int argc, char **argv)
{
    doit();

    exit(EXIT_SUCCESS);
}<commit_msg>- require to provide filename<commit_after>
#include <stdlib.h>
#include <unistd.h>
#include <getopt.h>
#include <iostream>

#include "storage/StorageImpl.h"
#include "storage/Environment.h"
#include "storage/Devicegraph.h"
#include "storage/Utils/SystemCmd.h"
#include "storage/Utils/Logger.h"


using namespace std;
using namespace storage;


void
doit(const string& filename)
{
    set_logger(get_logfile_logger());

    Environment environment(true, ProbeMode::READ_DEVICEGRAPH, TargetMode::DIRECT);

    environment.set_devicegraph_filename(filename);

    Storage storage(environment);

    const Devicegraph* probed = storage.get_probed();

    cout << *probed << endl;

    const TmpDir& tmp_dir = storage.get_impl().get_tmp_dir();

    probed->write_graphviz(tmp_dir.get_fullname() + "/display.gv", GraphvizFlags::CLASSNAME |
			   GraphvizFlags::SID | GraphvizFlags::SIZE);
    system(string("dot -Tsvg < " + quote(tmp_dir.get_fullname() + "/display.gv") + " > " +
		  quote(tmp_dir.get_fullname() + "/display.svg")).c_str());
    unlink(string(tmp_dir.get_fullname() + "/display.gv").c_str());
    system(string("display " + quote(tmp_dir.get_fullname() + "/display.svg")).c_str());
    unlink(string(tmp_dir.get_fullname() + "/display.svg").c_str());
}


void usage() __attribute__ ((__noreturn__));

void
usage()
{
    cerr << "display filename" << endl;
    exit(EXIT_FAILURE);
}


int
main(int argc, char **argv)
{
    if (argc != 2)
	usage();

    doit(argv[1]);

    exit(EXIT_SUCCESS);
}
{'fraction_non_alphanumeric': 0.16831345826235095, 'fraction_numerical': 0.0006814310051107325, 'mean_word_length': 4.74559686888454, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 1}, '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': '2053681', 'n_tokens_mistral': 1060, 'n_tokens_neox': 1022, 'n_words': 173}