// // Created by mwo on 6/11/15. // #include "CmdLineOptions.h" namespace xmreg { /** * Take the acc and *avv[] from the main() and check and parse * all the options given */ CmdLineOptions::CmdLineOptions(int acc, const char *avv[]) { positional_options_description p; p.add("txhash", -1); options_description desc( "xmrblocks, start Onion Monero Blockchain Explorer"); desc.add_options() ("help,h", value()->default_value(false)->implicit_value(true), "produce help message") ("testnet,t", value()->default_value(false)->implicit_value(true), "use testnet blockchain") ("enable-pusher", value()->default_value(false)->implicit_value(true), "enable pushing signed tx") ("port,p", value()->default_value("8081"), "default port") ("bc-path,b", value(), "path to lmdb blockchain") ("ssl-crt-file", value(), "A path to crt file for ssl (https) functionality") ("ssl-key-file", value(), "A path to key file for ssl (https) functionality") ("custom-db-path,c", value(), "path to the custom lmdb database used for searching things") ("deamon-url,d", value()->default_value("http:://127.0.0.1:18081"), "monero address string"); store(command_line_parser(acc, avv) .options(desc) .positional(p) .run(), vm); notify(vm); if (vm.count("help")) { if (vm["help"].as()) cout << desc << "\n"; } } /** * Return the value of the argument passed to the program * in wrapped around boost::optional */ template boost::optional CmdLineOptions::get_option(const string & opt_name) const { if (!vm.count(opt_name)) { return boost::none; } return vm[opt_name].as(); } // explicit instantiations of get_option template function template boost::optional CmdLineOptions::get_option(const string & opt_name) const; template boost::optional CmdLineOptions::get_option(const string & opt_name) const; template boost::optional CmdLineOptions::get_option(const string & opt_name) const; }