<commit_before>#include "input.hpp"

#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

#include <string>

using namespace std;
using namespace IronBee::CLI;

//! A producer of input generators.
using input_factory_t     = boost::function<input_generator_t(const string&)>;

//! A map of command line argument to factory.
using input_factory_map_t = map<string,input_factory_t>;

input_generator_t init_audit_input( const string& arg );
input_generator_t init_raw_input(   const string& arg );

int main( int argc, char** argv )
{
  namespace po = boost::program_options;

  bool show_help = false;

  po::options_description desc(
    "All input options can be repeated.  Inputs will be processed in the"
    "order listed."
  );
  po::options_description general( "General:" );
  general.add_options()
    ( "help", po::bool_switch( &show_help ), "Output help message." )
    ;
  
  po::options_description input( "Input Options:" );
  input.add_options()
    ( "audit,A", po::value<string>(),
      "Mod Security Audit Log"
    )
    ( "raw,R", po::value<string>(),
      "Raw inputs.  Use comma separated pair: request path,response path.  "
      "Raw input will use bogus connection information."
    )
    ;
  desc.add( general ).add( input );
  
  po::variables_map vm;
  auto options = po::parse_command_line( argc, argv, desc );

  if ( show_help ) {
    cerr << desc << endl;
    return 1;
  }

  // Declare input types.
  input_factory_map_t input_factory_map;
  input_factory_map["audit"] = &init_audit_input;
  input_factory_map["raw"]   = &init_raw_input;
<commit_msg>CPP: Refactor ibcli_cpp to keep argument variables separate.<commit_after>#include "input.hpp"

#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>

#include <string>

using namespace std;
using namespace IronBee::CLI;

//! A producer of input generators.
using input_factory_t     = boost::function<input_generator_t(const string&)>;

//! A map of command line argument to factory.
using input_factory_map_t = map<string,input_factory_t>;

input_generator_t init_audit_input( const string& arg );
input_generator_t init_raw_input(   const string& arg );

int main( int argc, char** argv )
{
  namespace po = boost::program_options;

  bool show_help = false;

  po::options_description desc(
    "All input options can be repeated.  Inputs will be processed in the"
    "order listed."
  );

  po::options_description general_desc( "General:" );
  general_desc.add_options()
    ( "help", po::bool_switch( &show_help ), "Output help message." )
    ;

  po::options_description input_desc( "Input Options:" );
  input_desc.add_options()
    ( "audit,A", po::value<string>(),
      "Mod Security Audit Log"
    )
    ( "raw,R", po::value<string>(),
      "Raw inputs.  Use comma separated pair: request path,response path.  "
      "Raw input will use bogus connection information."
    )
    ;
  desc.add( general_desc ).add( input_desc );

  po::variables_map vm;
  auto options = po::parse_command_line( argc, argv, desc );

  if ( show_help ) {
    cerr << desc << endl;
    return 1;
  }

  // Declare input types.
  input_factory_map_t input_factory_map;
  input_factory_map["audit"] = &init_audit_input;
  input_factory_map["raw"]   = &init_raw_input;

{'fraction_non_alphanumeric': 0.12141549725442342, 'fraction_numerical': 0.0006101281269066504, 'mean_word_length': 4.044615384615384, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 17, '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': '1600858', 'n_tokens_mistral': 1078, 'n_tokens_neox': 1056, 'n_words': 285}