-
Notifications
You must be signed in to change notification settings - Fork 7
/
odc-rp-same.cpp
54 lines (43 loc) · 1.76 KB
/
odc-rp-same.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/********************************************************************************
* Copyright (C) 2019-2023 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
* *
* This software is distributed under the terms of the *
* GNU Lesser General Public Licence (LGPL) version 3, *
* copied verbatim in the file "LICENSE" *
********************************************************************************/
#include <odc/Version.h>
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <iostream>
using namespace std;
namespace bpo = boost::program_options;
int main(int argc, char** argv)
{
try {
string res;
std::string partitionID;
bpo::options_description options("odc-rp-same options");
options.add_options()
("id", bpo::value<std::string>(&partitionID)->default_value(""), "Partition ID")
("res", bpo::value<string>(&res)->default_value(""), "Resource description")
("version,v", "Print version")
("help,h", "Print help");
bpo::variables_map vm;
bpo::store(bpo::command_line_parser(argc, argv).options(options).run(), vm);
bpo::notify(vm);
if (vm.count("help")) {
cout << options;
return EXIT_SUCCESS;
}
if (vm.count("version")) {
cout << ODC_VERSION << endl;
return EXIT_SUCCESS;
}
cout << res;
} catch (exception& _e) {
cerr << _e.what();
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}