<commit_before>#include "app-cmdline.h"
#include "app-gui.h"
#include "debug.h"

extern "C" {
#include "optparse.h"
#include "warnp.h"
}

#include <stdlib.h>

int main(int argc, char *argv[])
{
    struct optparse *opt;

    // Initialize debug messages.
    WARNP_INIT;
    ConsoleLog::instance().initializeConsoleLog();

    // Parse command-line arguments
    if((opt = optparse_parse(argc, argv)) == NULL)
        exit(1);

    // Should we use the gui or non-gui app?
    if(opt->check == 0)
    {
        // Basic initialization that cannot fail.
        AppGui app(argc, argv, opt);
        optparse_free(opt);

        // Run more complicated initialization.
        if(!app.initializeCore())
            return EXIT_FAILURE;

        // If we want the GUI or have any tasks, do them.
        if(app.prepMainLoop())
            return (app.exec());
        else
            return EXIT_SUCCESS;
    }
    else
    {
        // Basic initialization that cannot fail.
        AppCmdline app(argc, argv, opt);
        optparse_free(opt);

        // Run more complicated initialization.
        if(!app.initializeCore())
            return EXIT_FAILURE;

        // If we want have any tasks, do them.
        if(app.prepMainLoop())
            return (app.exec());
        else
            return EXIT_SUCCESS;
    }<commit_msg>main.cpp: allow building without GUI<commit_after>#include "app-cmdline.h"
#include "debug.h"

#ifdef QT_GUI_LIB
#include "app-gui.h"
#endif

extern "C" {
#include "optparse.h"
#include "warnp.h"
}

#include <stdlib.h>

int main(int argc, char *argv[])
{
    struct optparse *opt;

    // Initialize debug messages.
    WARNP_INIT;
    ConsoleLog::instance().initializeConsoleLog();

    // Parse command-line arguments
    if((opt = optparse_parse(argc, argv)) == NULL)
        exit(1);

    // Should we use the gui or non-gui app?
    if(opt->check == 0)
    {
#ifdef QT_GUI_LIB
        // Basic initialization that cannot fail.
        AppGui app(argc, argv, opt);
        optparse_free(opt);

        // Run more complicated initialization.
        if(!app.initializeCore())
            return EXIT_FAILURE;

        // If we want the GUI or have any tasks, do them.
        if(app.prepMainLoop())
            return (app.exec());
        else
            return EXIT_SUCCESS;
#else
        qDebug() << "This binary does not support GUI operations.  Try:\n\t"
                 << argv[0] << "-h";
        exit(1);
#endif
    }
    else
    {
        // Basic initialization that cannot fail.
        AppCmdline app(argc, argv, opt);
        optparse_free(opt);

        // Run more complicated initialization.
        if(!app.initializeCore())
            return EXIT_FAILURE;

        // If we want have any tasks, do them.
        if(app.prepMainLoop())
            return (app.exec());
        else
            return EXIT_SUCCESS;
    }
{'fraction_non_alphanumeric': 0.12018061827023271, 'fraction_numerical': 0.0020840569642236887, 'mean_word_length': 2.028391167192429, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '2428131', 'n_tokens_mistral': 881, 'n_tokens_neox': 861, 'n_words': 249}