<commit_before>
#include <nstd/Console.h>
#include <nstd/Process.h>

#include <nstd/Thread.h>
#include <nstd/Signal.h>

uint_t threadProc(void_t* param)
{
  Signal* termSignal = (Signal*)param;
  int_t counter = 0;
  while(!termSignal->wait(1000))
  {
    if(counter % 5 == 0)
      Console::errorf(_T("%d%s"), counter, ((counter + 1) % 3) == 0 ? _T("\n") : _T(" "));
    else
      Console::printf(_T("%d%s"), counter, ((counter + 1) % 3) == 0 ? _T("\n") : _T(" "));
    ++counter;
  }
  return 0;
}

int_t main(int_t argc, tchar_t* argv[])
{
  String password(_T("<PASSWORD>"));
  String user(_T("root"));
  String address(_T("127.0.0.1:13211"));
  {
    Process::Option options[] = {
        {_T('p'), _T("password"), Process::argumentFlag},
        {_T('u'), _T("user"), Process::argumentFlag},
    };
    Process::Arguments arguments(argc, argv, options);
    int_t character;
    String argument;
    while(arguments.read(character, argument))
      switch(character)
      {
      case 'p':
        password = argument;
        break;
      case 'u':
        user = argument;
        break;
      case 0:
        address = argument;
        break;
      case '?':
        Console::errorf(_T("Unknown option: %s.\n"), (const tchar_t*)argument);
        return 1;
      case ':':
        Console::errorf(_T("Option %s required an argument.\n"), (const tchar_t*)argument);
        return 1;
      default:
        Console::errorf(_T("Usage: %s [-u <user>] [-p <password>] [<address>]\n"));
        return 1;
      }
  }

  Console::printf(_T("user=%s, password=%s, address=%s\n"),
    (const tchar_t*)user, (const tchar_t*)password, (const tchar_t*)address);

  Console::printf(_T("Hello World!\n"));

  Console::Prompt prompt;
  Thread thread;
  Signal termSignal;
  thread.start(threadProc, &termSignal);
  for(;;)<commit_msg>Add help option to console test<commit_after>
#include <nstd/Console.h>
#include <nstd/Process.h>

#include <nstd/Thread.h>
#include <nstd/Signal.h>

uint_t threadProc(void_t* param)
{
  Signal* termSignal = (Signal*)param;
  int_t counter = 0;
  while(!termSignal->wait(1000))
  {
    if(counter % 5 == 0)
      Console::errorf(_T("%d%s"), counter, ((counter + 1) % 3) == 0 ? _T("\n") : _T(" "));
    else
      Console::printf(_T("%d%s"), counter, ((counter + 1) % 3) == 0 ? _T("\n") : _T(" "));
    ++counter;
  }
  return 0;
}

int_t main(int_t argc, tchar_t* argv[])
{
  String password(_T("<PASSWORD>"));
  String user(_T("root"));
  String address(_T("127.0.0.1:13211"));
  {
    Process::Option options[] = {
        {_T('p'), _T("password"), Process::argumentFlag},
        {_T('u'), _T("user"), Process::argumentFlag},
        {_T('h'), _T("help"), Process::optionFlag},
    };
    Process::Arguments arguments(argc, argv, options);
    int_t character;
    String argument;
    while(arguments.read(character, argument))
      switch(character)
      {
      case 'p':
        password = argument;
        break;
      case 'u':
        user = argument;
        break;
      case 0:
        address = argument;
        break;
      case '?':
        Console::errorf(_T("Unknown option: %s.\n"), (const tchar_t*)argument);
        return 1;
      case ':':
        Console::errorf(_T("Option %s required an argument.\n"), (const tchar_t*)argument);
        return 1;
      default:
        Console::errorf(_T("Usage: %s [-u <user>] [-p <password>] [<address>]\n"), argv[0]);
        return 1;
      }
  }

  Console::printf(_T("user=%s, password=%s, address=%s\n"),
    (const tchar_t*)user, (const tchar_t*)password, (const tchar_t*)address);

  Console::printf(_T("Hello World!\n"));

  Console::Prompt prompt;
  Thread thread;
  Signal termSignal;
  thread.start(threadProc, &termSignal);
  for(;;)
{'fraction_non_alphanumeric': 0.19396206251669784, 'fraction_numerical': 0.01576275714667379, 'mean_word_length': 3.0607375271149673, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5286651', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1284, 'n_words': 278}