-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
committed
Sep 10, 2018
1 parent
4554bc0
commit ef27195
Showing
4 changed files
with
31 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,37 @@ | ||
#include <iostream> | ||
#include <exception> | ||
#include <boost/program_options/cmdline.hpp> | ||
#include <boost/program_options/options_description.hpp> | ||
#include <boost/program_options.hpp> | ||
|
||
struct NotImplementedError: public std::exception | ||
{ | ||
}; | ||
|
||
namespace po = boost::program_options; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
using options_description = boost::program_options::options_description; | ||
options_description desc("Allowed options:"); | ||
std::cout << "Hello world!" << std::endl; | ||
po::options_description desc("Arguments: "); | ||
desc.add_options() | ||
("help", "produce help messages") | ||
("input-file", po::value< std::string >(), "input file path") | ||
("output", po::value< std::string >(), "output file path") | ||
; | ||
po::positional_options_description p; | ||
p.add("input-file", -1); | ||
|
||
po::variables_map vm; | ||
po::store(po::command_line_parser(argc, argv). | ||
options(desc).positional(p).run(), vm); | ||
po::notify(vm); | ||
|
||
if (vm.count("help")) { | ||
std::cout << "Usage: options_description [options]\n"; | ||
std::cout << desc << std::endl; | ||
return 0; | ||
} | ||
if (vm.count("output")) | ||
{ | ||
// std::cout << desc["output"].as<std::string>() << std::endl; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters