From 329ba24eab7ee016bd103367c061f87f04f6d282 Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Wed, 4 Apr 2012 15:11:30 +0200 Subject: [PATCH] streamlined command line options --- apps/mwiniimporter/main.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 051e7db2b..234d7d57d 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -9,7 +9,8 @@ namespace bpo = boost::program_options; int main(int argc, char *argv[]) { - bpo::options_description desc("Syntax: mwiniimporter -i inifile -c configfile \nAllowed options"); + bpo::options_description desc("Syntax: mwiniimporter inifile configfile\nAllowed options"); + bpo::positional_options_description p_desc; desc.add_options() ("help,h", "produce help message") ("verbose,v", "verbose output") @@ -18,9 +19,15 @@ int main(int argc, char *argv[]) { ("output,o", bpo::value()->default_value(""), "openmw.cfg file") ("game-files,g", "import esm and esp files") ; + p_desc.add("ini", 1).add("cfg", 1); bpo::variables_map vm; - bpo::store(boost::program_options::parse_command_line(argc, argv, desc), vm); + bpo::parsed_options parsed = bpo::command_line_parser(argc, argv) + .options(desc) + .positional(p_desc) + .run(); + + bpo::store(parsed, vm); if(vm.count("help") || !vm.count("ini") || !vm.count("cfg")) { std::cout << desc;