Overview
Provides a templatised c++ parser for handling command line arguments. The templates provide a very flexible manner for handling any type of input argument.
The code for the command line parser is a simple wrapper around another template header library called TCLAP. Since it is relatively small, its bundled here in the command_line subdirectory and namespaced in a convenient manner.
Alternatives
A more complicated, but more flexible alternative (it allows argument parsing from both command line and configuration file simultaneously) is the boost::program_options library.
Compiling & Linking
Include the following at the top of any translation unit:
1 #include <ecl/command_line.hpp>
2
3 // Interface classes
4 using ecl::CmdLine;
5 using ecl::ArgException
6 // Argument classes
7 using ecl::SwitchArg;
8 using ecl::ValueArg;
9 using ecl::MultiArg;
10 using ecl::UnlabeledValueArg;
11 using ecl::UnlabeledMultiArg; // there are more - see tclap docs
12
Tutorials
Examples
src/examples/command_line.cpp.