diff options
Diffstat (limited to 'test/windows_h.cxx')
-rw-r--r-- | test/windows_h.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/windows_h.cxx b/test/windows_h.cxx new file mode 100644 index 0000000..007a1e7 --- /dev/null +++ b/test/windows_h.cxx @@ -0,0 +1,37 @@ +#ifdef _WIN32 +#include "windows.h" +#else +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#endif + +#include <iostream> +#include <args.hxx> + +int main(int argc, char** argv) +{ + args::ArgumentParser parser("This is a test program.", "This goes after the options."); + args::HelpFlag help(parser, "help", "Display this help menu", {'h', "help"}); + args::CompletionFlag completion(parser, {"complete"}); + try + { + parser.ParseCLI(argc, argv); + } + catch (args::Completion& e) + { + std::cout << e.what(); + return 0; + } + catch (args::Help&) + { + std::cout << parser; + return 0; + } + catch (args::ParseError& e) + { + std::cerr << e.what() << std::endl; + std::cerr << parser; + return 1; + } + return 0; +} |