From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- cli-examples/file/driver.cxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cli-examples/file/driver.cxx (limited to 'cli-examples/file/driver.cxx') diff --git a/cli-examples/file/driver.cxx b/cli-examples/file/driver.cxx new file mode 100644 index 0000000..b53574c --- /dev/null +++ b/cli-examples/file/driver.cxx @@ -0,0 +1,35 @@ +// file : file/driver.cxx +// author : Boris Kolpackov +// license : MIT; see accompanying LICENSE file + +#include +#include +#include + +#include "options.hxx" + +using namespace std; + +int +main (int argc, char* argv[]) +{ + try + { + cli::argv_file_scanner s (argc, argv, "--options-file"); + options o (s); + + cout << "verbosity: " << o.verbose () << endl + << "values: "; + + copy (o.val ().begin (), + o.val ().end (), + ostream_iterator (cout, " ")); + + cerr << endl; + } + catch (const cli::exception& e) + { + cerr << e << endl; + return 1; + } +} -- cgit v1.1