blob: a9befe164dd00c4648baa2b02707f02b9cb61108 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#include "windows.h"
#include <iostream>
#include <args.hxx>
int main()
{
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;
}
|