void monitor_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         (MONITOR_OPT_ACTION_TYPE, boost::program_options::value<uint32_t>(), "The type of operation monitored")
         ;
   config_file_options.add(command_line_options);
}
Example #2
0
void application::set_program_options(boost::program_options::options_description& command_line_options,
                                      boost::program_options::options_description& configuration_file_options) const
{
   configuration_file_options.add_options()
         ("p2p-endpoint", bpo::value<string>(), "Endpoint for P2P node to listen on")
         ("seed-node,s", bpo::value<vector<string>>()->composing(), "P2P nodes to connect to on startup (may specify multiple times)")
         ("rpc-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8090"), "Endpoint for websocket RPC to listen on")
         ("rpc-tls-endpoint", bpo::value<string>()->implicit_value("127.0.0.1:8089"), "Endpoint for TLS websocket RPC to listen on")
         ("server-pem,p", bpo::value<string>()->implicit_value("server.pem"), "The TLS certificate file for this server")
         ("server-pem-password,P", bpo::value<string>()->implicit_value(""), "Password for this certificate")
         ("genesis-json", bpo::value<boost::filesystem::path>(), "File to read Genesis State from")
         ("apiaccess", bpo::value<boost::filesystem::path>(), "JSON file specifying API permissions")
         ;
   command_line_options.add(configuration_file_options);
   command_line_options.add_options()
         ("create-genesis-json", bpo::value<boost::filesystem::path>(),
          "Path to create a Genesis State at. If a well-formed JSON file exists at the path, it will be parsed and any "
          "missing fields in a Genesis State will be added, and any unknown fields will be removed. If no file or an "
          "invalid file is found, it will be replaced with an example Genesis State.")
         ("replay-blockchain", "Rebuild object graph by replaying all blocks")
         ("resync-blockchain", "Delete all blocks and re-sync with network from scratch")
         ;
   command_line_options.add(_cli_options);
   configuration_file_options.add(_cfg_options);
}
Example #3
0
  void
  Engine::getCommonOptions(boost::program_options::options_description& opts)
  {
    boost::program_options::options_description simopts("Common Engine Options");

    simopts.add_options()
      ("events,c", boost::program_options::value<size_t>()
       ->default_value(std::numeric_limits<size_t>::max(), "no-limit"),
       "No. of events to run the simulation for.")
      ("print-events,p", boost::program_options::value<size_t>()->default_value(100000), 
       "No. of events between periodic screen output.")
      ("random-seed,s", boost::program_options::value<unsigned int>(),
       "Random seed for generator (To make the simulation reproduceable - Only for debugging!)")
      ("ticker-period,t",boost::program_options::value<double>(), 
       "Time between data collections. Defaults to the system MFT or 1 if no MFT available")
      ("equilibrate,E", "Turns off most output for a fast silent run")
      ("load-plugin,L", boost::program_options::value<std::vector<std::string> >(), 
       "Additional individual plugins to load")
      ("sim-end-time,f", boost::program_options::value<double>()->default_value(std::numeric_limits<double>::max(), "no limit"), 
       "Simulation end time (Note, In replica exchange, each systems end time is scaled by"
       "(T_cold/T_i)^{1/2}, see replex-interval)")
      ("unwrapped", "Don't apply the boundary conditions of the system when writing out the particle positions.")
      ("snapshot", boost::program_options::value<double>(),
       "Sets the system time inbetween saving snapshots of the system.")
      ;
  
    opts.add(simopts);
  }
Example #4
0
void delayed_node_plugin::plugin_set_program_options(bpo::options_description& cli, bpo::options_description& cfg)
{
   cli.add_options()
         ("trusted-node", boost::program_options::value<std::string>(), "RPC endpoint of a trusted validating node (required)")
         ;
   cfg.add(cli);
}
Example #5
0
void producer_plugin::set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   auto default_priv_key = private_key_type::regenerate<fc::ecc::private_key_shim>(fc::sha256::hash(std::string("nathan")));
   auto private_key_default = std::make_pair(default_priv_key.get_public_key(), default_priv_key );

   boost::program_options::options_description producer_options;

   producer_options.add_options()
         ("enable-stale-production,e", boost::program_options::bool_switch()->notifier([this](bool e){my->_production_enabled = e;}), "Enable block production, even if the chain is stale.")
         ("required-participation", boost::program_options::value<uint32_t>()
                                       ->default_value(uint32_t(config::required_producer_participation/config::percent_1))
                                       ->notifier([this](uint32_t e) {
                                          my->_required_producer_participation = std::min(e, 100u) * config::percent_1;
                                       }),
                                       "Percent of producers (0-100) that must be participating in order to produce blocks")
         ("producer-name,p", boost::program_options::value<vector<string>>()->composing()->multitoken(),
          "ID of producer controlled by this node (e.g. inita; may specify multiple times)")
         ("private-key", boost::program_options::value<vector<string>>()->composing()->multitoken()->default_value({fc::json::to_string(private_key_default)},
                                                                                                fc::json::to_string(private_key_default)),
          "Tuple of [public key, WIF private key] (may specify multiple times)")
         ;
   config_file_options.add(producer_options);
}
Example #6
0
bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& visibleDesc,
    po::options_description& hiddenDesc,
    po::positional_options_description& positionalDesc,
    po::variables_map& vm, String& cmdname, CLICommand::Ptr& command, bool autocomplete)
{
	boost::mutex::scoped_lock lock(GetRegistryMutex());

	typedef std::map<std::vector<String>, CLICommand::Ptr>::value_type CLIKeyValue;

	std::vector<String> best_match;
	int arg_end = 1;

	BOOST_FOREACH(const CLIKeyValue& kv, GetRegistry()) {
		const std::vector<String>& vname = kv.first;

		for (int i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
			if (strcmp(argv[k], "--no-stack-rlimit") == 0 || strcmp(argv[k], "--autocomplete") == 0 || strcmp(argv[k], "--scm") == 0) {
				i--;
				continue;
			}

			if (vname[i] != argv[k])
				break;

			if (i >= best_match.size())
				best_match.push_back(vname[i]);

			if (i == vname.size() - 1) {
				cmdname = boost::algorithm::join(vname, " ");
				command = kv.second;
				arg_end = k;
				goto found_command;
			}
		}
	}

found_command:
	lock.unlock();

	po::options_description vdesc("Command options");

	if (command)
		command->InitParameters(vdesc, hiddenDesc);

	visibleDesc.add(vdesc);

	if (autocomplete)
		return true;

	po::options_description adesc;
	adesc.add(visibleDesc);
	adesc.add(hiddenDesc);

	po::store(po::command_line_parser(argc - arg_end, argv + arg_end).options(adesc).positional(positionalDesc).run(), vm);
	po::notify(vm);

	return true;
}
Example #7
0
void DebugNetOutputStream::addCommandLineOptions(boost::program_options::options_description& desc)
{
	po::options_description debugOps("Net Debug Options");
	debugOps.add_options()
		("debug-port", po::value<unsigned short>(), "Listen for incoming telnet connections on this port. Then replicate all debug output on those connections.")
	;

	desc.add(debugOps);
}
void options_system::process_options(int ac, char *av[])
{
    try {
        po::options_description  cmdline_options;
        cmdline_options.add(*generics).add(*configure);

        visible->add(*generics);
        visible->add(*configure);

        store(po::command_line_parser(ac,av).options(cmdline_options).run(), vm);
        notify(vm);


    } catch(std::exception ex) {
        std::cout<<" Error : " <<  ex.what() <<std::endl;
    }

}
Example #9
0
void account_history_plugin::plugin_set_program_options(
   boost::program_options::options_description& cli,
   boost::program_options::options_description& cfg
   )
{
   cli.add_options()
         ("track-account", boost::program_options::value<std::vector<std::string>>()->composing()->multitoken(), "Account ID to track history for (may specify multiple times)")
         ;
   cfg.add(cli);
}
Example #10
0
void DebugStream::addCommandLineOptions(boost::program_options::options_description& desc)
{
	po::options_description debugOps("Debug Options");
	debugOps.add_options()
		("debug", po::value< std::vector<code_part> >(), "Enable debug messages for given level")
		("debugfile", po::value< std::vector<fs::path> >(), "Log debug output to file")
	;

	desc.add(debugOps);
}
Example #11
0
int options_system::default_condition()
{
    std::ifstream ifs(config_file->c_str());

    if(!ifs) {
        std::cout<< "cannot open file name : " << *config_file <<std::endl;
    } else {
        config_file_options  = new po::options_description();
        config_file_options->add(*configure);

        store(parse_config_file(ifs, *config_file_options),vm);
        notify(vm);
    }

    if(vm.count("help")) {
        std::cout<< *visible <<std::endl;
        return 0;
    }

    if(vm.count("version")) {
        std::cout<< "HanumanAV, version releases :  0.0.1 " <<std::endl;
    }

    if(vm.count("db-signature-path")) {
        std::vector<std::string>  vec =  vm["db-signature-path"].as<std::vector<std::string> >();
        database_path = new std::stringstream;
        read_config(*database_path,vec);
    }

    if(vm.count("scanning-file")) {
        std::vector<std::string>  vec =  vm["scanning-file"].as<std::vector<std::string> >();
        scanfile_path = new std::stringstream;
        read_config(*scanfile_path,vec);
    }

    if(vm.count("cl-file")) {
        std::vector<std::string>  vec =  vm["cl-file"].as<std::vector<std::string> >();
        clfile_path = new std::stringstream;
        read_config(*clfile_path,vec);
    }

    if(vm.count("logger-main")) {
        std::vector<std::string>  vec =  vm["logger-main"].as<std::vector<std::string> >();
        logger_mainfile_path = new std::stringstream;
        read_config(*logger_mainfile_path,vec);
    }

    if(vm.count("logger-settings")) {
        std::vector<std::string> vec =  vm["logger-settings"].as<std::vector<std::string> >();
        logger_settingsfile_path = new std::stringstream;
        read_config(*logger_settingsfile_path,vec);

    }

}
Example #12
0
void snapshot_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         (OPT_BLOCK_NUM, bpo::value<uint32_t>(), "Block number after which to do a snapshot")
         (OPT_BLOCK_TIME, bpo::value<string>(), "Block time (ISO format) after which to do a snapshot")
         (OPT_DEST, bpo::value<string>(), "Pathname of JSON file where to store the snapshot")
         ;
   config_file_options.add(command_line_options);
}
Example #13
0
void engine_factory::setup_options(boost::program_options::options_description& options) {
  for (engine_data::const_iterator it = s_engine_data.data().begin(); it != s_engine_data.data().end(); ++ it) {
    std::stringstream ss;
    ss << "Engine '" << it->second->get_id() << "' options";
    boost::program_options::options_description engine_options(ss.str());
    it->second->setup_options(engine_options);
    if (engine_options.options().size() > 0) {
      options.add(engine_options);
    }
  }
}
	void addToOptions(po::options_description &options, std::string section, std::string prefix, std::string default_host, std::string default_name, bool use_root = false) {
		po::options_description desc(section);
		desc.add_options()
			((prefix+"host").c_str(), po::value<std::string>(&host)->default_value(default_host),"Mysql host")
			((prefix+"port").c_str(), po::value<in_port_t>(&port)->default_value(3306), "Mysql port")
			((prefix+"user").c_str(), po::value<std::string>(&user)->default_value(use_root?"root":"monamour2"),"Mysql user")
			((prefix+"pass").c_str(), po::value<std::string>(&pass)->default_value(use_root?"":"monamourchik"),"Mysql pass")
			((prefix+"name").c_str(), po::value<std::string>(&name)->default_value(default_name),"Mysql database name")
		;
		options.add(desc);
	}
Example #15
0
void account_history_plugin::plugin_set_program_options(
   boost::program_options::options_description& cli,
   boost::program_options::options_description& cfg
   )
{
   cli.add_options()
         ("track-account-range", boost::program_options::value<std::vector<std::string>>()->composing()->multitoken(), "Defines a range of accounts to track as a json pair [\"from\",\"to\"] [from,to]")
         ("filter-posting-ops", "Ignore posting operations, only track transfers and account updates")
         ;
   cfg.add(cli);
}
	void addToOptions(po::options_description &options, std::string section, std::string prefix, std::string default_host, int default_port, bool add_timeout, int default_timeout = 0) {
		po::options_description desc(section);
		desc.add_options()
			((prefix+"host").c_str(), po::value<std::string>(&host)->default_value(default_host),"Host")
			((prefix+"port").c_str(), po::value<in_port_t>(&port)->default_value(default_port), "Port")
		;
		if (add_timeout) {
			desc.add_options() ((prefix+"timeout").c_str(), po::value<int>(&timeout)->default_value(default_timeout),"Timeout") ;
		}
		options.add(desc);
	}
Example #17
0
void Scenario::setupOptions(int argc,
                            char **argv,
                            boost::program_options::options_description &options,
                            boost::program_options::variables_map &variables)
{
  boost::program_options::options_description local("Scenario " + d->m_name);
  setupOptions(local, variables);

  if (variables.empty())
    options.add(local);
  else
    d->m_options = variables;
}
Example #18
0
void witness_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   command_line_options.add_options()
         ("enable-stale-production", bpo::bool_switch()->notifier([this](bool e){_production_enabled = e;}), "Enable block production, even if the chain is stale")
         ("witness-id,w", bpo::value<vector<string>>()->composing()->multitoken(),
          "ID of witness controlled by this node (e.g. \"1.7.0\", quotes are required, may specify multiple times)")
         ("private-key", bpo::value<vector<string>>()->composing()->multitoken()->
          DEFAULT_VALUE_VECTOR(std::make_pair(chain::key_id_type(), fc::ecc::private_key::regenerate(fc::sha256::hash(std::string("genesis"))))),
          "Tuple of [key ID, private key] (may specify multiple times)")
         ;
   config_file_options.add(command_line_options);
}
void elasticsearch_plugin::plugin_set_program_options(
   boost::program_options::options_description& cli,
   boost::program_options::options_description& cfg
   )
{
   cli.add_options()
         ("elasticsearch-node-url", boost::program_options::value<std::string>(), "Elastic Search database node url")
         ("elasticsearch-bulk-replay", boost::program_options::value<uint32_t>(), "Number of bulk documents to index on replay(5000)")
         ("elasticsearch-bulk-sync", boost::program_options::value<uint32_t>(), "Number of bulk documents to index on a syncronied chain(10)")
         ("elasticsearch-logs", boost::program_options::value<bool>(), "Log bulk events to database")
         ("elasticsearch-visitor", boost::program_options::value<bool>(), "Use visitor to index additional data(slows down the replay)")
         ;
   cfg.add(cli);
}
Example #20
0
  void 
  ECompressingSimulation::getOptions(boost::program_options::options_description& opts)
  {
    boost::program_options::options_description ropts("Compression Engine (--engine=3)");

    ropts.add_options()
      ("growth-rate",boost::program_options::value<double>()->default_value(1.0),
       "Compression rate for the simulation")
      ("target-pack-frac",boost::program_options::value<double>(),
       "Target packing fraction that compression has to attain to exit")
      ("target-density",boost::program_options::value<double>(),
       "Target number density that compression has to attain to exit")
      ;
    opts.add(ropts);
  }
Example #21
0
void handle_opts(
    po::options_description &opts_micro,
    po::variables_map &vm
)
{
    opts_main.add(opts_micro);
    po::store(po::parse_command_line(ac, av, opts_main), vm); // could be exchanged with a config file parser

    // hendling the "help" option
    if (vm.count("help"))
    {
        std::cout << opts_main;
        exit(EXIT_SUCCESS);
    }
    po::notify(vm); // includes checks for required options
}
Example #22
0
void witness_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   auto default_priv_key = fc::ecc::private_key::regenerate(fc::sha256::hash(std::string("nathan")));
   string witness_id_example = fc::json::to_string(chain::witness_id_type(5));
   command_line_options.add_options()
         ("enable-stale-production", bpo::bool_switch()->notifier([this](bool e){_production_enabled = e;}), "Enable block production, even if the chain is stale.")
         ("required-participation", bpo::bool_switch()->notifier([this](int e){_required_witness_participation = uint32_t(e*GRAPHENE_1_PERCENT);}), "Percent of witnesses (0-99) that must be participating in order to produce blocks")
         ("witness-id,w", bpo::value<vector<string>>()->composing()->multitoken(),
          ("ID of witness controlled by this node (e.g. " + witness_id_example + ", quotes are required, may specify multiple times)").c_str())
         ("private-key", bpo::value<vector<string>>()->composing()->multitoken()->
          DEFAULT_VALUE_VECTOR(std::make_pair(chain::public_key_type(default_priv_key.get_public_key()), graphene::utilities::key_to_wif(default_priv_key))),
          "Tuple of [PublicKey, WIF private key] (may specify multiple times)")
         ;
   config_file_options.add(command_line_options);
}
Example #23
0
void witness_plugin::plugin_set_program_options(
   boost::program_options::options_description& command_line_options,
   boost::program_options::options_description& config_file_options)
{
   string witness_id_example = "initwitness";
   command_line_options.add_options()
         ("enable-stale-production", bpo::bool_switch()->notifier([this](bool e){_production_enabled = e;}), "Enable block production, even if the chain is stale.")
         ("required-participation", bpo::bool_switch()->notifier([this](int e){_required_witness_participation = uint32_t(e*STEEMIT_1_PERCENT);}), "Percent of witnesses (0-99) that must be participating in order to produce blocks")
         ("witness,w", bpo::value<vector<string>>()->composing()->multitoken(),
          ("name of witness controlled by this node (e.g. " + witness_id_example+" )" ).c_str())
         ("miner,m", bpo::value<vector<string>>()->composing()->multitoken(), "name of miner and its private key (e.g. [\"account\",\"WIF PRIVATE KEY\"] )" )
         ("mining-threads,t", bpo::value<uint32_t>(),"Number of threads to use for proof of work mining" )
         ("private-key", bpo::value<vector<string>>()->composing()->multitoken(), "WIF PRIVATE KEY to be used by one or more witnesses or miners" )
         ("miner-account-creation-fee", bpo::value<uint64_t>()->implicit_value(100000),"Account creation fee to be voted on upon successful POW - Minimum fee is 100.000 STEEM (written as 100000)")
         ("miner-maximum-block-size", bpo::value<uint32_t>()->implicit_value(131072),"Maximum block size (in bytes) to be voted on upon successful POW - Max block size must be between 128 KB and 750 MB")
         ("miner-sbd-interest-rate", bpo::value<uint32_t>()->implicit_value(1000),"SBD interest rate to be vote on upon successful POW - Default interest rate is 10% (written as 1000)")
         ;
   config_file_options.add(command_line_options);
}
Example #24
0
void get_option_description(po::options_description &od_desc) {
    /* po::options_description help_od_desc("Help"),
        required_od_desc("Required options"),
        optional_od_desc("Optional options");
    */
    po::options_description help_od_desc("Help"),
        general_od_desc("General"),
        db_options_od_desc("Database options"),
        not_used_od_desc("Not used currently");

    help_od_desc.add_options()
        // help
        ("help", "Produce help message for this version.")
        ("version,v", "Print version string");

    general_od_desc.add_options()
        // general
        ("file,f", po::value<std::string>()->required(), "REQUIRED: Name of the osm file.")
        ("conf,c", po::value<std::string>()->default_value("/usr/share/osm2pgrouting/mapconfig.xml"), "Name of the configuration xml file.")
        ("schema", po::value<std::string>()->default_value(""), "Database schema to put tables.\n  blank:\t defaults to default schema dictated by PostgreSQL search_path.")
        ("prefix", po::value<std::string>()->default_value(""), "Prefix added at the beginning of the table names.")
        ("suffix", po::value<std::string>()->default_value(""), "Suffix added at the end of the table names.")
        ("addnodes", "Import the osm_nodes table.")
        ("clean", "Drop previously created tables.");

    db_options_od_desc.add_options()
        // database options
        ("dbname,d", po::value<std::string>()->required(), "Name of your database (Required).")
        ("username,U", po::value<std::string>()->default_value("postgres"), "Name of the user, which have write access to the database.")
        ("host,h", po::value<std::string>()->default_value("localhost"), "Host of your postgresql database.")
        ("port,p", po::value<std::string>()->default_value("5432"), "db_port of your database.")
        ("password,W", po::value<std::string>()->default_value(""), "Password for database access.");

    not_used_od_desc.add_options()
        ("threads,t", po::value<bool>()->default_value(false), "threads.")
        ("multimodal,m", po::value<bool>()->default_value(false), "multimodal.")
        ("multilevel,l", po::value<bool>()->default_value(false), "multilevel.");

    od_desc.add(help_od_desc).add(general_od_desc).add(db_options_od_desc);  // .add(not_used_od_desc);

    return;
}
Example #25
0
void setupAndParseArguments(int argc, char *argv[])
{
    generic.add_options()
            ("version", "Print current version")
            ("help,h", "Print this");

    optional.add_options()
            ("test,t", "Do not physically move files")
            ("verbose,v", "Provide verbose output")
            ("config,c", po::value<std::string>(&configPath)->default_value("config.json"), "Specify configuration file");

    hidden.add_options()
            ("input,i", po::value<std::vector<std::string>>(&paths), "Path to files or directories");

    po::options_description cmdline;
    cmdline.add(generic).add(optional).add(hidden);
    visible.add(generic).add(optional);

    po::positional_options_description p;
    p.add("input", -1);
    po::store(po::command_line_parser(argc, argv).options(cmdline).positional(p).run(), vm);
    po::notify(vm);
}
Example #26
0
void
Config::setOptDesc(
    po::options_description& opts,
    bool useDefaults)
{
    po::options_description genOpts("Generator Arguments");
    genOpts.add_options()
        ("cpp",
            (useDefaults ? po::value<std::string>()->default_value(cpp())
                         : po::value<std::string>()),
            "Output file name for C++ generated source")
        ("cl", po::value<std::string>(),
            "Output file name for OpenCL generated source")
        ("data",
            (useDefaults ? po::value<std::string>()->default_value("random")
                         : po::value<std::string>()),
            "Data generation pattern\n"
            "Format: {random | unit | sawtooth}")
        ( "skip-accuracy",
          "Don't generate code for accuracy check. Applicable if the program "
          "is needed only for performance measurement")
    ;

    po::options_description openclOpts("OpenCL Arguments");
    openclOpts.add_options()
        ("platform",
            (useDefaults ? po::value<std::string>()->default_value(platform())
                         : po::value<std::string>()),
            "Platform name")
        ("device",
            (useDefaults ? po::value<std::string>()->default_value(device())
                         : po::value<std::string>()),
            "Device name")
        ("build-options", po::value<std::string>(),
            "Build options")
    ;

    po::options_description kargsOpts("BLAS Arguments");
    kargsOpts.add_options()
        ("function,f", po::value<std::string>(),
            "Function name, mandatory\n"
            "Format: {s | d | c | z}{BLAS function}")
        ("order",
            (useDefaults ? po::value<clblasOrder>()->default_value(clblasRowMajor)
                         : po::value<clblasOrder>()),
            "Data ordering\n"
            "Format: {column | row}")
        ("side",
            (useDefaults ? po::value<clblasSide>()->default_value(clblasLeft)
                         : po::value<clblasSide>()),
            "The side matrix A is located relative to matrix B\n"
            "Format: {left | right}")
        ("uplo",
            (useDefaults ? po::value<clblasUplo>()->default_value(clblasUpper)
                         : po::value<clblasUplo>()),
            "Upper or lower triangle of matrix is being referenced\n"
            "Format: {upper | lower}")
        ("transA",
            (useDefaults ? po::value<clblasTranspose>()->default_value(clblasNoTrans)
                         : po::value<clblasTranspose>()),
            "Matrix A transposition operation\n"
            "Format: {n | t | c}")
        ("transB",
            (useDefaults ? po::value<clblasTranspose>()->default_value(clblasNoTrans)
                         : po::value<clblasTranspose>()),
            "Matrix B transposition operation\n"
            "Format: {n | t | c}")
        ("diag",
            (useDefaults ? po::value<clblasDiag>()->default_value(clblasNonUnit)
                         : po::value<clblasDiag>()),
            "Whether the matrix is unit triangular\n"
            "Format: {unit | nonunit}")
        ("M,M",
            (useDefaults ? po::value<size_t>()->default_value(256)
                         : po::value<size_t>()->default_value(256))
        )
        ("N,N",
            (useDefaults ? po::value<size_t>()->default_value(256)
                         : po::value<size_t>())
        )
        ("K,K",
            (useDefaults ? po::value<size_t>()->default_value(256)
                         : po::value<size_t>())
        )
        ("alpha",
            (useDefaults ? po::value<std::string>()->default_value("1")
                         : po::value<std::string>()),
            "Alpha multiplier\n"
            "Format: real[,imag]")
        ("beta",
            (useDefaults ? po::value<std::string>()->default_value("1")
                         : po::value<std::string>()),
            "Beta multiplier\n"
            "Format: real[,imag]")
        ("lda", po::value<size_t>(),
            "Leading dimension of the matrix A")
        ("ldb", po::value<size_t>(),
            "Leading dimension of the matrix B")
        ("ldc", po::value<size_t>(),
            "Leading dimension of the matrix C")
        ("offA",
            (useDefaults ? po::value<size_t>()->default_value(0)
                         : po::value<size_t>()),
            "Start offset in buffer of matrix A")
        ("offBX",
            (useDefaults ? po::value<size_t>()->default_value(0)
                         : po::value<size_t>()),
            "Start offset in buffer of matrix B or vector X")
        ("offCY",
            (useDefaults ? po::value<size_t>()->default_value(0)
                         : po::value<size_t>()),
            "Start offset in buffer of matrix C or vector Y")
        ("incx",
            (useDefaults ? po::value<int>()->default_value(1)
                         : po::value<int>()),
            "Increment in the array X")
        ("incy",
            (useDefaults ? po::value<int>()->default_value(1)
                         : po::value<int>()),
            "Increment in the array Y")
    ;

    po::options_description decompositionOpts("Decomposition Options");
    decompositionOpts.add_options()
        ("decomposition,d", po::value<std::string>(),
            "SubproblemDim\n"
            "Format: {subdims[0].x},{subdims[0].y},\n"
            "        {subdims[0].bwidth},\n"
            "        {subdims[1].x},{subdims[1].y},\n"
            "        {subdims[1].bwidth}")
        ("multikernel", useDefaults ? po::value<bool>()->default_value(false)
                                    : po::value<bool>(),
            "Allow division of one BLAS function between several kernels")
    ;

    opts.add(genOpts).add(openclOpts).add(kargsOpts).add(decompositionOpts);
}
Example #27
0
bool CLICommand::ParseCommand(int argc, char **argv, po::options_description& visibleDesc,
	po::options_description& hiddenDesc,
	po::positional_options_description& positionalDesc,
	po::variables_map& vm, String& cmdname, CLICommand::Ptr& command, bool autocomplete)
{
	boost::mutex::scoped_lock lock(GetRegistryMutex());

	typedef std::map<std::vector<String>, CLICommand::Ptr>::value_type CLIKeyValue;

	std::vector<String> best_match;
	int arg_end = 0;
	bool tried_command = false;

	for (const CLIKeyValue& kv : GetRegistry()) {
		const std::vector<String>& vname = kv.first;

		std::vector<String>::size_type i;
		int k;
		for (i = 0, k = 1; i < vname.size() && k < argc; i++, k++) {
			if (strncmp(argv[k], "-", 1) == 0 || strncmp(argv[k], "--", 2) == 0) {
				i--;
				continue;
			}

			tried_command = true;

			if (vname[i] != argv[k])
				break;

			if (i >= best_match.size())
				best_match.push_back(vname[i]);

			if (i == vname.size() - 1) {
				cmdname = boost::algorithm::join(vname, " ");
				command = kv.second;
				arg_end = k;
				goto found_command;
			}
		}
	}

found_command:
	lock.unlock();

	if (command) {
		po::options_description vdesc("Command options");
		command->InitParameters(vdesc, hiddenDesc);
		visibleDesc.add(vdesc);
	}

	if (autocomplete || (tried_command && !command))
		return true;

	po::options_description adesc;
	adesc.add(visibleDesc);
	adesc.add(hiddenDesc);

	if (command && command->IsDeprecated()) {
		std::cerr << ConsoleColorTag(Console_ForegroundRed | Console_Bold)
			<< "Warning: CLI command '" << cmdname << "' is DEPRECATED! Please read the Changelog."
			<< ConsoleColorTag(Console_Normal) << std::endl << std::endl;
	}

	po::store(po::command_line_parser(argc - arg_end, argv + arg_end).options(adesc).positional(positionalDesc).run(), vm);
	po::notify(vm);

	return true;
}
void populate_options(po::options_description &config_file_options) {
   po::options_description game_config("Game options");
   game_config.add_options()
      ("game.type,g", po::value<string>()->default_value("MATCH"),
      "Type of game/challenge (MATCH, DRIBBLE, OPEN, PASSING)");

   po::options_description player_config("Player options");
   player_config.add_options()
      ("player.number,n", po::value<int>()->default_value(2),
      "player number")
      ("player.team,T", po::value<int>()->default_value(19),
      "team number");

   po::options_description debug_config("Debugging options");
   debug_config.add_options()
      ("debug.log,l", po::value<string>()->default_value("SILENT"),
      "log level used by llog")
      ("debug.log.motion,m", po::value<bool>()->default_value(false),
      "allow llog from motion")
      ("debug.logpath",
      po::value<string>()->default_value("/var/volatile/runswift"),
      "where to store log files")
      ("debug.shutdowntime", po::value<int>()->default_value(0),
      "shutdown after arg seconds")
      ("debug.gamecontroller,G", po::value<bool>()->default_value(true),
      "enable GameController thread")
      ("debug.motion,M", po::value<bool>()->default_value(true),
      "enable Motion thread")
      ("debug.offnaotransmitter,O", po::value<bool>()->default_value(true),
      "enable OffNaoTransmitter thread")
      ("debug.perception,P", po::value<bool>()->default_value(true),
      "enable Perception thread")
      ("debug.vision,V", po::value<bool>()->default_value(true),
      "enable Vision module")
      ("debug.behaviour,B", po::value<bool>()->default_value(true),
      "enable Behaviour module")
      ("debug.naotransmitter,C", po::value<bool>()->default_value(true),
      "enable Nao Transmitter module")
      ("debug.naoreceiver,R", po::value<bool>()->default_value(true),
       "enable Nao Receiver module")
      ("debug.remotecontrol", po::value<bool>()->default_value(true),
       "enable Remote Control Receiver module")
      ("debug.dump,D", po::value<string>()->default_value(""),
      "Dump blackboard in .bbd format. Empty string disables.")
      ("debug.mask", po::value<int>()->default_value(INITIAL_MASK),
      "Blackboard mask determining what is serialised");

   po::options_description behaviour_config("Behaviour options");
   behaviour_config.add_options()
      ("behaviour.skill,s",
      po::value<string>()->default_value("GameController"),
      "The desired top level Python skill class.")
      ("behaviour.path", po::value<string>()->default_value("/home/nao/data/behaviours/"),
      "path containing python behaviours.")
      ("default.body", po::value<string>()->default_value("REF_PICKUP"),
      "default body action type if behaviour isn't running")
      ("default.forward", po::value<int>()->default_value(0),
      "default forward parameter for the walk (mm/step)")
      ("default.left", po::value<int>()->default_value(0),
      "default left parameter for the walk (mm/step)")
      ("default.turn", po::value<float>()->default_value(0.0f),
      "default turn parameter for the walk (deg/step)")
      ("default.power", po::value<float>()->default_value(1.0f),
      "default power parameter for the kick (0.0-1.0)")
      ("default.speed", po::value<float>()->default_value(1.0f),
      "default speed parameter for the walk (0.0-1.0)")
      ("default.bend", po::value<float>()->default_value(15.0f),
      "default bend parameter for the walk (0.0-1.0)")
      ("default.foot", po::value<string>()->default_value("LEFT"),
      "default kick foot (LEFT/RIGHT)")
      ("default.kickDirection", po::value<float>()->default_value(0.0),
      "default kickDirection (degrees)")
      ("default.whichCamera", po::value<string>()->default_value("BEHAVIOUR"),
      "which camera to use");

   po::options_description motion_config("Motion options");
   motion_config.add_options()
      ("motion.effector,e", po::value<string>()->default_value("Agent"),
      "effector to be used by motion")
      ("motion.touch,t", po::value<string>()->default_value("Agent"),
      "touch to be used by motion")
      ("motion.path",
      po::value<string>()->default_value("/home/nao/data/pos/"),
      "the path of .pos files for ActionGenerator")
      ("motion.v3", po::value<bool>()->default_value(false),
      "whether to use v3 version of getup instead")
      ("walk.f", po::value<float>()->default_value(0.5),
      "frequency of coronal plane rocking (Hz)")
      ("walk.st", po::value<float>()->default_value(1.0),
      "stiffness of leg joints (0.0 - 1.0)")
      ("walk.cs", po::value<bool>()->default_value(true),
      "coronal stabilisation on/off")
      ("walk.r", po::value<float>()->default_value(20.0),
      "amplitude of coronal plane rocking (degrees)")
      ("walk.s", po::value<float>()->default_value(5.0),
      "spread of legs when standing (degrees)")
      ("walk.l", po::value<float>()->default_value(20.0),
      "amplitude of leg lift (degrees)")
      ("walk.fs", po::value<float>()->default_value(5.0),
      "amplitude of forward step (degrees)")
      ("walk.ls", po::value<float>()->default_value(0.0),
      "amplitude of left step (degrees)")
      ("walk.ts", po::value<float>()->default_value(0.0),
      "amplitude of turn step (degrees)")
      ("walk.b", po::value<float>()->default_value(15.0),
      "bend of legs when standing upright (degrees)")
      ("walk.liftHeight", po::value<float>()->default_value(8.0f),
      "leg lift height.")
      ("walk.coronalAmplitude", po::value<float>()->default_value(0.0f),
      "Coronal rock amplitude.")
      ("walk.liftFrac", po::value<float>()->default_value(0.5f),
      "fraction of cycle in which leg lift is performed.")
      ("walk.moveFrac", po::value<float>()->default_value(0.4f),
      "fraction of cycle in which leg move is performed.")
      ("walk.m", po::value<float>()->default_value(0.0),
      "leg lift frequency multiplier (must be multiple of two)");

   po::options_description vision_config("Vision options");
   vision_config.add_options()
      ("vision.camera,c", po::value<string>()->default_value("Nao"),
      "camera to be used by vision")
      ("vision.camera_controls", po::value<string>()->default_value(""),
      "comma separated list of cid:value pairs of controls "
      "(cid offset from V4L2_CID_BASE)")
      ("vision.dumpframes,d", po::value<bool>()->default_value(false),
      "dump frames to disk")
      ("vision.dumprate,r", po::value<int>()->default_value(1000),
      "dump frames every arg milliseconds")
      ("vision.top_calibration", po::value<string>()->default_value("/home/nao/data/top.nnmc"),
      "location of colour calibration file")
      ("vision.bot_calibration", po::value<string>()->default_value("/home/nao/data/bot.nnmc"),
      "location of colour calibration file")
      ("vision.goal_map", po::value<string>()->default_value("/home/nao/data/goals.map"),
      "location of surf natural landmarks starting goal map")
		("vision.vocab", po::value<string>()->default_value("/home/nao/data/words.vocab"),
      "location of dictionary of visual words for surf localisation")
      ("vision.seeBluePosts", po::value<bool>()->default_value(false),
      "blue posts are detected")
      ("vision.seeLandmarks", po::value<bool>()->default_value(true),
      "landmarks are detected")      
      ("vision.dumpfile,f", po::value<string>()->default_value("dump.yuv"),
      "file to store frames in");

   po::options_description camera_config("Camera options");
   camera_config.add_options()
      ("camera.top.hflip", po::value<int>()->default_value(1),
       "camera top hflip")
      ("camera.top.vflip", po::value<int>()->default_value(1),
       "camera top vflip")
      ("camera.top.brightness", po::value<int>()->default_value(248),
       "camera top brightness")
      ("camera.top.contrast", po::value<int>()->default_value(60),
       "camera top contrast")
      ("camera.top.saturation", po::value<int>()->default_value(130),
       "camera top saturation")
      ("camera.top.hue", po::value<int>()->default_value(0),
       "camera top hue")
      ("camera.top.sharpness", po::value<int>()->default_value(2),
       "camera top sharpness")
      ("camera.top.backlightcompensation", po::value<int>()->default_value(0x00),
       "camera top backlight compensation")
      ("camera.top.exposure", po::value<int>()->default_value(17),
       "camera top exposure")
      ("camera.top.gain", po::value<int>()->default_value(250),
       "camera top gain")
      ("camera.top.whitebalance", po::value<int>()->default_value(-60),
       "camera top whitebalance")


      ("camera.bot.hflip", po::value<int>()->default_value(0),
       "camera bot hflip")
      ("camera.bot.vflip", po::value<int>()->default_value(0),
       "camera bot vflip")
      ("camera.bot.brightness", po::value<int>()->default_value(248),
       "camera bot brightness")
      ("camera.bot.contrast", po::value<int>()->default_value(60),
       "camera bot contrast")
      ("camera.bot.saturation", po::value<int>()->default_value(180),
       "camera bot saturation")
      ("camera.bot.hue", po::value<int>()->default_value(0),
       "camera bot hue")
      ("camera.bot.sharpness", po::value<int>()->default_value(2),
       "camera bot sharpness")
      ("camera.bot.backlightcompensation", po::value<int>()->default_value(0x00),
       "camera bot backlight compensation")
      ("camera.bot.exposure", po::value<int>()->default_value(17),
       "camera bot exposure")
      ("camera.bot.gain", po::value<int>()->default_value(250),
       "camera bot gain")
      ("camera.bot.whitebalance", po::value<int>()->default_value(-55),
       "camera bot whitebalance");


   po::options_description kinematics_config("Kinematics options");
   kinematics_config.add_options()
      ("kinematics.isCalibrating", po::value<bool>()->default_value(false),
      "If set to true run kinematics calibration.")
      ("kinematics.bodyPitch", po::value<float>()->default_value(0.0),
      "accounts for imperfections in all motors in the robots body.")
      ("kinematics.cameraYawTop", po::value<float>()->default_value(0.0),
      "difference between real camera Yaw compared to aldebaran specs")
      ("kinematics.cameraRollTop", po::value<float>()->default_value(0.0),
      "difference between real camera Roll compared to aldebaran specs")
      ("kinematics.cameraRollBottom", po::value<float>()->default_value(0.0),
      "difference between real camera Roll compared to aldebaran specs")
      ("kinematics.cameraPitchTop", po::value<float>()->default_value(0.0),
      "difference between real camera Pitch compared to aldebaran specs")
      ("kinematics.cameraYawBottom", po::value<float>()->default_value(0.0),
      "difference between real camera Yaw compared to aldebaran specs")
      ("kinematics.cameraPitchBottom", po::value<float>()->default_value(0.0),
      "difference between real camera Pitch compared to aldebaran specs");

   po::options_description touch_config("Touch options");
   touch_config.add_options()
      ("touch.gyrXOffset", po::value<float>()->default_value(0.0),
      "offset on gyrX.")
      ("touch.gyrYOffset", po::value<float>()->default_value(0.0),
      "offset on gyrY.")
      ("touch.angleXOffset", po::value<float>()->default_value(0.0),
      "offset on angleX")
      ("touch.angleYOffset", po::value<float>()->default_value(0.0),
      "offset on angleY");

   po::options_description gamecontroller_config("GameController options");
   gamecontroller_config.add_options()
      ("gamecontroller.connect", po::value<bool>()->default_value(true),
      "whether the GameController should try to connect")
      ("gamecontroller.state", po::value<string>()->default_value("INITIAL"),
      "game state if gamecontroller not connected, can be: "
      "INITIAL, READY, SET, PLAYING, FINISHED")
      ("gamecontroller.secondarystate",
      po::value<string>()->default_value("NORMAL"),
      "secondary game state if gamecontroller not connected, can be: "
      "NORMAL, PENALTYSHOOT")
      ("gamecontroller.ourcolour", po::value<string>()->default_value("blue"),
      "our team colour if gamecontroller not connected")
      ("gamecontroller.opponentteam", po::value<int>()->default_value(1),
      "opponent team number if gamecontroller not connected")
      ("gamecontroller.ourscore", po::value<int>()->default_value(0),
      "our team's score if gamecontroller not connected")
      ("gamecontroller.opponentscore", po::value<int>()->default_value(0),
      "opponent team's score if gamecontroller not connected")
      ("gamecontroller.firsthalf", po::value<bool>()->default_value(true),
      "whether we're in the first half if gamecontroller not connected")
      ("gamecontroller.kickoffteam", po::value<string>()->default_value("red"),
      "which team kicks off if gamecontroller not connected")
      ("gamecontroller.secsremaining", po::value<int>()->default_value(600),
      "seconds left in the half if gamecontroller not connected");

   po::options_description transmitter_config("Transmitter options");
   transmitter_config.add_options()
      ("transmitter.address", po::value<string>()->default_value
         ("192.168.0.255"), "address to broadcast to")
      // TODO: Is this dead code?
      // ... transmitter.port is now transmitter.base_port + player.team
      ("transmitter.port", po::value<int>()->default_value(13371),
      "port to broadcast on");

   po::options_description network_config("Networking options");
   network_config.add_options()
      ("network.wireless.iwconfig_flags", po::value<string>()->default_value
         ("essid RUNSWIFT"), "iwconfig arguments to connect ra0")
      ("network.wireless.static", po::value<bool>()->default_value
         (true), "set the wireless to static")
      ("network.wireless.static.ifconfig_flags",
      po::value<string>()->default_value
         ("192.168.0.100 netmask 255.255.255.0 up"),
      "ifconfig arguments to connect ra0")
      ("network.wired.static", po::value<bool>()->default_value
         (false), "set the wired to static")
      ("network.wired.static.ifconfig_flags", po::value<string>()->default_value
         (""), "ifconfig arguments to connect eth0");

   po::options_description remote_control_config("Remote Control options");
   remote_control_config.add_options()
      ("remotecontrol.port", po::value<int>()->default_value(4000),
       "port to receive on");

   config_file_options.add(game_config).add(player_config)
   .add(gamecontroller_config).add(debug_config).add(behaviour_config)
   .add(motion_config).add(vision_config).add(camera_config).add(kinematics_config)
   .add(transmitter_config).add(network_config).add(touch_config);
}
Example #29
0
File: main.cpp Project: jamella/stp
void ExtraMain::create_options()
{
  po::options_description hiddenOptions("Hidden options");
  hiddenOptions.add_options()
  ("file", po::value<string>(&infile), "input file")
  #ifdef USE_CRYPTOMINISAT4
  ("cryptominisat", "same as --cryptominisat4")
  #endif
  ;

  // Declare the supported options.
  po::options_description general_options("Most important options");
  general_options.add_options()
    ("help,h", "print this help")
    ("version", "print version number")
    ("disable-simplify", "disable all simplifications")
    ("switch-word,w", "switch off wordlevel solver")
    ("disable-opt-inc,a", "disable potentially size-increasing optimisations")
    ("disable-cbitp", "disable constant bit propagation")
    ("disable-equality", "disable equality propagation");

  po::options_description solver_options("SAT Solver options");
  solver_options.add_options()
#ifdef USE_CRYPTOMINISAT4
      ("cryptominisat4",
       "use cryptominisat4 as the solver. Only use CryptoMiniSat 4.2 or above.")
      ("threads", po::value<int>(&bm->UserFlags.num_solver_threads)->default_value(bm->UserFlags.num_solver_threads)
      , "Number of threads for cryptominisat")
#endif
      ("simplifying-minisat", "use installed simplifying minisat version as the solver")(
          "minisat", "use installed minisat version as the solver (default)")
  ;

  po::options_description refinement_options("Refinement options");
  refinement_options.add_options()(
      "oldstyle-refinement",
      "Do abstraction-refinement outside the SAT solver")(
      "ackermanize,r", po::bool_switch(&(bm->UserFlags.ackermannisation)),
      "eagerly encode array-read axioms (Ackermannistaion)")(
      "flatten,x", po::bool_switch(&(bm->UserFlags.xor_flatten_flag)),
      "flatten XORs");

  po::options_description print_options("Printing options");
  print_options.add_options()
  ("print-stpinput,b",
      po::bool_switch(&(bm->UserFlags.print_STPinput_back_flag)),
      "print STP input back to cout")
  ("print-back-CVC",
      po::bool_switch(&(bm->UserFlags.print_STPinput_back_CVC_flag)),
      "print input in CVC format, then exit")
  ("print-back-SMTLIB2",
      po::bool_switch(&(bm->UserFlags.print_STPinput_back_SMTLIB2_flag)),
      "print input in SMT-LIB2 format, then exit")
  ("print-back-SMTLIB1",
      po::bool_switch((&bm->UserFlags.print_STPinput_back_SMTLIB1_flag)),
      "print input in SMT-LIB1 format, then exit")
  ("print-back-GDL",
      po::bool_switch(&(bm->UserFlags.print_STPinput_back_GDL_flag)),
      "print AiSee's graph format, then exit")
  ("print-back-dot",
      po::bool_switch(&(bm->UserFlags.print_STPinput_back_dot_flag)),
      "print dotty/neato's graph format, then exit")
  ("print-counterex,p",
      po::bool_switch(&(bm->UserFlags.print_counterexample_flag)),
      "print counterexample")
  ("print-counterexbin,y",
      po::bool_switch(&(bm->UserFlags.print_binary_flag)),
      "print counterexample in binary")
  ("print-arrayval,q",
      po::bool_switch(&(bm->UserFlags.print_arrayval_declaredorder_flag)),
      "print arrayval declared order")
  ("print-functionstat,s", po::bool_switch(&(bm->UserFlags.stats_flag)),
      "print function statistics")
  ("print-quickstat,t",
      po::bool_switch(&(bm->UserFlags.quick_statistics_flag)),
      "print quick statistics")
  ("print-nodes,v", po::bool_switch(&(bm->UserFlags.print_nodes_flag)),
      "print nodes ")
  /*("constr-counterex,c",
     po::bool_switch(&(bm->UserFlags.construct_counterexample_flag))
      , "construct counterexample")*/
  ("print-varorder,z",
      po::bool_switch(&(bm->UserFlags.print_sat_varorder_flag)),
      "Print SAT variable order")
  ("print-output,n", po::bool_switch(&(bm->UserFlags.print_output_flag)),
      "Print output");

  po::options_description input_options("Input options");
  input_options.add_options()
  ("SMTLIB1,m", "use the SMT-LIB1 format parser")
  ("SMTLIB2", "use the SMT-LIB2 format parser")
  ("CVC,m", "use the CVC format parser");

  po::options_description output_options("Output options");
  output_options.add_options()(
      "output-CNF", po::bool_switch(&(bm->UserFlags.output_CNF_flag)),
      "save the CNF into output_[0..n].cnf")(
      "output-bench", po::bool_switch(&(bm->UserFlags.output_bench_flag)),
      "save in ABC's bench format to output.bench");

  po::options_description misc_options("Output options");
  misc_options.add_options()("exit-after-CNF",
                             po::bool_switch(&(bm->UserFlags.exit_after_CNF)),
                             "exit after the CNF has been generated")
      ("timeout,g", po::value<int64_t>(&max_num_confl),
       "Number of conflicts after which the SAT solver gives up. -1 means never (default)")
      ("check-sanity,d", "construct counterexample and check it");

  cmdline_options.add(general_options)
      .add(solver_options)
      .add(refinement_options)
      .add(print_options)
      .add(input_options)
      .add(output_options)
      .add(misc_options)
      .add(hiddenOptions);

  // Register everything except hiddenOptions
  visible_options.add(general_options)
      .add(solver_options)
      .add(refinement_options)
      .add(print_options)
      .add(input_options)
      .add(output_options)
      .add(misc_options);

  pos_options.add("file", 1);
}
Example #30
0
bithorded::Config::Config(int argc, char* argv[])
{
	po::options_description cli_options("Command-Line Options");
	cli_options.add_options()
		("version,v", "print version string")
		("help", "produce help message")
		("config,c", po::value<string>(&configPath)->default_value("/etc/bithorde.conf"),
			"Path to config-file")
	;

	po::options_description config_options("Config Options");
	config_options.add_options()
		("server.name", po::value<string>(&nodeName)->default_value(asio::ip::host_name()),
			"Name of this node, defaults to hostname")
		("server.tcpPort", po::value<uint16_t>(&tcpPort)->default_value(1337),
			"TCP port to listen on for incoming connections")
		("server.unixSocket", po::value<string>(&unixSocket)->default_value("/tmp/bithorde"),
			"Path to UNIX-socket to listen on")
	;

	cmdline_options.add(cli_options).add(config_options);

	DynamicMap vm;
	vm.store(po::parse_command_line(argc, argv, cmdline_options));
	notify(vm);

	if (vm.count("version"))
		throw VersionExit();

	if (!configPath.empty()) {
		std::ifstream cfg(configPath);
		vm.store(po::parse_config_file(cfg, config_options, true));
		notify(vm);
	}

	if (vm.count("help")) {
		throw ArgumentError("Usage:");
	}

	vector<OptionGroup> source_opts = vm.groups("source");
	for (auto opt=source_opts.begin(); opt != source_opts.end(); opt++) {
		Source src;
		src.name = opt->name();
		src.root = (*opt)["root"].as<string>();
		sources.push_back(src);
	}

	vector<OptionGroup> friend_opts = vm.groups("friend");
	for (auto opt=friend_opts.begin(); opt != friend_opts.end(); opt++) {
		Friend f;
		f.name = opt->name();
		string addr = (*opt)["addr"].as<string>();
		size_t colpos = addr.rfind(':');
		f.addr = addr.substr(0, colpos);
		if (colpos == string::npos)
			f.port = 1337;
		else
			f.port = boost::lexical_cast<ushort>(addr.substr(colpos+1));
		friends.push_back(f);
	}

	if (friends.empty() && sources.empty()) {
		throw ArgumentError("Needs at least one friend or source root to receive assets.");
	}
}