| 54 | po::options_description main_options("Main for Table benchmark"); |
| 55 | |
| 56 | po::variables_map initCommandLine(int argc, const char* argv[]) |
| 57 | { |
| 58 | main_options.add_options()("help,h", "help of Table benchmark")( |
| 59 | "path,p", po::value<string>()->default_value(""), "[RocksDB path]")("name,n", |
| 60 | po::value<string>()->default_value(""), "[RocksDB name]")("table,t", po::value<string>(), |
| 61 | "table name ")("key,k", po::value<string>()->default_value(""), "table key")( |
| 62 | "iterate,i", po::value<bool>()->default_value(false), "traverse table")("config,c", |
| 63 | boost::program_options::value<std::string>()->default_value("./config.ini"), |
| 64 | "config file path, eg. config.ini")("genesis,g", |
| 65 | boost::program_options::value<std::string>()->default_value("./config.genesis"), |
| 66 | "genesis config file path, eg. genesis.ini"); |
| 67 | po::variables_map vm; |
| 68 | try |
| 69 | { |
| 70 | po::store(po::parse_command_line(argc, argv, main_options), vm); |
| 71 | po::notify(vm); |
| 72 | } |
| 73 | catch (...) |
| 74 | { |
| 75 | std::cout << "invalid input" << std::endl; |
| 76 | exit(0); |
| 77 | } |
| 78 | if (vm.count("help") || vm.count("h")) |
| 79 | { |
| 80 | std::cout << main_options << std::endl; |
| 81 | exit(0); |
| 82 | } |
| 83 | return vm; |
| 84 | } |
| 85 | |
| 86 | int main(int argc, const char* argv[]) |
| 87 | { |