2458 |
03 Apr 11 |
peter |
// $Id$ |
2458 |
03 Apr 11 |
peter |
2 |
|
2458 |
03 Apr 11 |
peter |
3 |
/* |
4207 |
26 Aug 22 |
peter |
Copyright (C) 2011, 2012, 2022 Peter Johansson |
2458 |
03 Apr 11 |
peter |
5 |
|
2458 |
03 Apr 11 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
2458 |
03 Apr 11 |
peter |
7 |
|
2458 |
03 Apr 11 |
peter |
The yat library is free software; you can redistribute it and/or |
2458 |
03 Apr 11 |
peter |
modify it under the terms of the GNU General Public License as |
2458 |
03 Apr 11 |
peter |
published by the Free Software Foundation; either version 3 of the |
2458 |
03 Apr 11 |
peter |
License, or (at your option) any later version. |
2458 |
03 Apr 11 |
peter |
12 |
|
2458 |
03 Apr 11 |
peter |
The yat library is distributed in the hope that it will be useful, |
2458 |
03 Apr 11 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
2458 |
03 Apr 11 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
2458 |
03 Apr 11 |
peter |
General Public License for more details. |
2458 |
03 Apr 11 |
peter |
17 |
|
2458 |
03 Apr 11 |
peter |
You should have received a copy of the GNU General Public License |
2458 |
03 Apr 11 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
2458 |
03 Apr 11 |
peter |
20 |
*/ |
2458 |
03 Apr 11 |
peter |
21 |
|
2881 |
18 Nov 12 |
peter |
22 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
23 |
|
2458 |
03 Apr 11 |
peter |
24 |
#include "yat/utility/CommandLine.h" |
2458 |
03 Apr 11 |
peter |
25 |
#include "yat/utility/Exception.h" |
2458 |
03 Apr 11 |
peter |
26 |
#include "yat/utility/OptionHelp.h" |
4153 |
09 Mar 22 |
peter |
27 |
#include "yat/utility/OptionVersion.h" |
2458 |
03 Apr 11 |
peter |
28 |
|
2458 |
03 Apr 11 |
peter |
29 |
#include <cstdlib> |
2458 |
03 Apr 11 |
peter |
30 |
#include <iostream> |
2458 |
03 Apr 11 |
peter |
31 |
#include <string> |
2458 |
03 Apr 11 |
peter |
32 |
|
2458 |
03 Apr 11 |
peter |
33 |
using namespace theplu::yat::utility; |
2458 |
03 Apr 11 |
peter |
34 |
|
2458 |
03 Apr 11 |
peter |
35 |
int main(int argc, char* argv[]) |
4153 |
09 Mar 22 |
peter |
36 |
{ |
2458 |
03 Apr 11 |
peter |
37 |
CommandLine cmd; |
2458 |
03 Apr 11 |
peter |
38 |
OptionHelp help(cmd); |
4153 |
09 Mar 22 |
peter |
// VERSION and PACKAGE #defined in config.h |
4153 |
09 Mar 22 |
peter |
40 |
OptionVersion version(cmd, "stdopt", VERSION, "2022", |
4153 |
09 Mar 22 |
peter |
41 |
{"John Doe", "Jane Doe"}, PACKAGE); |
2458 |
03 Apr 11 |
peter |
42 |
try { |
2458 |
03 Apr 11 |
peter |
43 |
cmd.parse(argc, argv); |
2458 |
03 Apr 11 |
peter |
44 |
} |
2458 |
03 Apr 11 |
peter |
45 |
catch (cmd_error& e) { |
2458 |
03 Apr 11 |
peter |
46 |
std::cerr << e.what() << "\n"; |
2458 |
03 Apr 11 |
peter |
47 |
return EXIT_FAILURE; |
2458 |
03 Apr 11 |
peter |
48 |
} |
2458 |
03 Apr 11 |
peter |
49 |
return EXIT_SUCCESS; |
2458 |
03 Apr 11 |
peter |
50 |
} |