<commit_before>/*
This file is licensed under the MIT-License
Copyright (c) 2015 <NAME>
For more details view file 'LICENSE'
*/
#include "command.h"

JetSpaceCMDArg *commandkit_arg_handle;
char *commandkit_app_name;
char *commandkit_app_version;
int commandkit_arg_handle_n = 0;

void jetspace_add_cmd_line_argument(char sh, char *arg, int id, char *disc, JetSpaceCMDArgCallback cb)
{
  commandkit_arg_handle_n++;
  commandkit_arg_handle = realloc(commandkit_arg_handle, sizeof(JetSpaceCMDArg) * commandkit_arg_handle_n);

  commandkit_arg_handle[commandkit_arg_handle_n - 1].sh = sh;
  commandkit_arg_handle[commandkit_arg_handle_n - 1].id = id;
  commandkit_arg_handle[commandkit_arg_handle_n - 1].cb = cb;

  commandkit_arg_handle[commandkit_arg_handle_n - 1].arg = malloc(strlen(arg));
  strncpy(commandkit_arg_handle[commandkit_arg_handle_n - 1].arg, arg, strlen(arg));

  commandkit_arg_handle[commandkit_arg_handle_n - 1].disc = malloc(strlen(disc) +1);
  strncpy(commandkit_arg_handle[commandkit_arg_handle_n - 1].disc, disc, strlen(disc));
}

bool jetspace_parse_cmd_line(int argc, char **argv)
{
  for(int x = 0; x < argc; x++)
  {
    if(argv[x][0] == '-') // Argument
    {
      if(argv[x][1] == '-')  // Long argument
      {

      }
      else  // Short Argument
      {
        for(int y = 1; y < strlen(argv[x]); y++)
        {
          char querry = argv[x][y];<commit_msg>Added long arguments<commit_after>/*
This file is licensed under the MIT-License
Copyright (c) 2015 <NAME>
For more details view file 'LICENSE'
*/
#include "command.h"

JetSpaceCMDArg *commandkit_arg_handle;
char *commandkit_app_name;
char *commandkit_app_version;
int commandkit_arg_handle_n = 0;

void jetspace_add_cmd_line_argument(char sh, char *arg, int id, char *disc, JetSpaceCMDArgCallback cb)
{
  commandkit_arg_handle_n++;
  commandkit_arg_handle = realloc(commandkit_arg_handle, sizeof(JetSpaceCMDArg) * commandkit_arg_handle_n);

  commandkit_arg_handle[commandkit_arg_handle_n - 1].sh = sh;
  commandkit_arg_handle[commandkit_arg_handle_n - 1].id = id;
  commandkit_arg_handle[commandkit_arg_handle_n - 1].cb = cb;

  commandkit_arg_handle[commandkit_arg_handle_n - 1].arg = malloc(strlen(arg) +2);
  memset(commandkit_arg_handle[commandkit_arg_handle_n -1].arg, 0, strlen(arg) +2);
  strncpy(commandkit_arg_handle[commandkit_arg_handle_n -1].arg, "--", 2);
  strncat(commandkit_arg_handle[commandkit_arg_handle_n - 1].arg, arg, strlen(arg));

  commandkit_arg_handle[commandkit_arg_handle_n - 1].disc = malloc(strlen(disc));
  strncpy(commandkit_arg_handle[commandkit_arg_handle_n - 1].disc, disc, strlen(disc));
}

bool jetspace_parse_cmd_line(int argc, char **argv)
{
  for(int x = 0; x < argc; x++)
  {
    if(argv[x][0] == '-') // Argument
    {
      if(argv[x][1] == '-')  // Long argument
      {
          if(strcmp(argv[x], "--help") == 0)
          {
            jetspace_cmd_line_print_help();
            continue;
          }
          for(int z = 0; z < commandkit_arg_handle_n; z++)
          {
            if(strcmp(argv[x], commandkit_arg_handle[z].arg) == 0)
            {
              commandkit_arg_handle[z].cb(argc, argv, commandkit_arg_handle[z].id, NULL);
              continue;
            }
          }
      }
      else  // Short Argument
      {
        for(int y = 1; y < strlen(argv[x]); y++)
        {
          char querry = argv[x][y];
{'fraction_non_alphanumeric': 0.1269982238010657, 'fraction_numerical': 0.012433392539964476, 'mean_word_length': 3.7524613220815755, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 5, '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': '6845957', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1202, 'n_words': 222}