<commit_before>#include <cgreen/cgreen.h>
#include <cgreen/xml_reporter.h>

#include <cgreen/vector.h>

#include "utils.h"

#include <unistd.h>
#include <libgen.h>

#include "gopt.h"

#include "runner.h"
#include "discoverer.h"


/*----------------------------------------------------------------------*/
static int file_exists(const char *filename)
{
    if (! filename) return 0;
    return (access(filename, F_OK) == 0);
}


/*----------------------------------------------------------------------*/
static void version(void) {
    printf("cgreen-runner for Cgreen unittest and mocking framework v%s\n", VERSION);
    printf("Cgreen library version %s (%s) loaded\n", cgreen_library_version, cgreen_library_revision);
}


/*----------------------------------------------------------------------*/
static void usage(const char *program_name) {
    printf("cgreen-runner for Cgreen unittest and mocking framework v%s\n\n", VERSION);
    printf("Usage:\n    %s [--suite <name>] [--verbose] [--quiet] [--no-run] "
#if HAVE_XML_REPORTER
           "--xml <prefix>"
#endif
#if HAVE_LIBXML2_REPORTER
           "--libxml2 <prefix>"
#endif
           "[--help] (<library> [<test>])+\n\n", program_name);
    printf("Discover and run all or named cgreen test(s) from one or multiple\n");
    printf("dynamically loadable libraries.\n\n");
    printf("A single test can be run using the form [<context>:]<name> where <context> can\n");
    printf("be omitted if there is no context.\n\n");
    printf("  -c --colours/colors\t\tUse colours to emphasis result (requires ANSI-capable terminal)\n");
    printf("  -C --no-colours/no-colors\tDon't use colours\n");
#if HAVE_XML_REPORTER
    printf("  -x --xml <prefix>\t\tInstead of messages on stdout, write results into one XML-file\n");
    printf("\t\t\t\tper suite, compatible with Hudson/Jenkins CI. The filename(s)\n");
    printf("\t\t\t\twill be '<prefix>-<suite>.xml'\n");
#endif
#if HAVE_LIBXML2_REPORTER
    printf("  -X --libxml2 <prefix>\t\tFormat the test results using libxml2\n");
#endif
    printf("  -s --suite <name>\t\tName the top level suite\n");
    printf("  -n --no-run\t\t\tDon't run the tests\n");
    printf("  -v --verbose\t\t\tShow progress information\n");
    printf("  -q --quiet\t\t\tJust output dots for each test\n");
    printf("     --version\t\t\tShow version information\n");
}


/*======================================================================*/

enum option_arg {<commit_msg>Fix formatting of the built-in usage text in cgreen-runner<commit_after>#include <cgreen/cgreen.h>
#include <cgreen/xml_reporter.h>

#include <cgreen/vector.h>

#include "utils.h"

#include <unistd.h>
#include <libgen.h>

#include "gopt.h"

#include "runner.h"
#include "discoverer.h"


/*----------------------------------------------------------------------*/
static int file_exists(const char *filename)
{
    if (! filename) return 0;
    return (access(filename, F_OK) == 0);
}


/*----------------------------------------------------------------------*/
static void version(void) {
    printf("cgreen-runner for Cgreen unittest and mocking framework v%s\n", VERSION);
    printf("Cgreen library version %s (%s) loaded\n", cgreen_library_version, cgreen_library_revision);
}


/*----------------------------------------------------------------------*/
static void usage(const char *program_name) {
    printf("cgreen-runner for Cgreen unittest and mocking framework v%s\n\n", VERSION);
    printf("Usage:\n    %s [--suite <name>] [--verbose] [--quiet] [--no-run] "
#if HAVE_XML_REPORTER
           "[--xml <prefix>] "
#endif
#if HAVE_LIBXML2_REPORTER
           "[--libxml2 <prefix>] "
#endif
           "[--help] (<library> [<test>])+\n\n", program_name);
    printf("Discover and run all or named cgreen test(s) from one or multiple\n");
    printf("dynamically loadable libraries.\n\n");
    printf("A single test can be run using the form [<context>:]<name> where <context> can\n");
    printf("be omitted if there is no context.\n\n");
    printf("  -c --colours/colors\t\tUse colours to emphasis result (requires ANSI-capable terminal)\n");
    printf("  -C --no-colours/no-colors\tDon't use colours\n");
#if HAVE_XML_REPORTER
    printf("  -x --xml <prefix>\t\tInstead of messages on stdout, write results into one XML-file\n");
    printf("\t\t\t\tper suite, compatible with Hudson/Jenkins CI. The filename(s)\n");
    printf("\t\t\t\twill be '<prefix>-<suite>.xml'\n");
#endif
#if HAVE_LIBXML2_REPORTER
    printf("  -X --libxml2 <prefix>\t\tFormat the test results using libxml2\n");
#endif
    printf("  -s --suite <name>\t\tName the top level suite\n");
    printf("  -n --no-run\t\t\tDon't run the tests\n");
    printf("  -v --verbose\t\t\tShow progress information\n");
    printf("  -q --quiet\t\t\tJust output dots for each test\n");
    printf("     --version\t\t\tShow version information\n");
}


/*======================================================================*/

enum option_arg {
{'fraction_non_alphanumeric': 0.26310504117292627, 'fraction_numerical': 0.0028118096003213497, 'mean_word_length': 2.4947368421052634, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, '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': '2447950', 'n_tokens_mistral': 1609, 'n_tokens_neox': 1557, 'n_words': 424}