forked from Zuehlke/cpp_example_project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (49 loc) · 1.39 KB
/
Copy pathmain.cpp
File metadata and controls
56 lines (49 loc) · 1.39 KB
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
55
56
#include "include/version.hpp"
#include <docopt/docopt.h>
#include <functional>
#include <iostream>
#include <spdlog/spdlog.h>
#include <string>
static constexpr auto USAGE =
R"(Naval Fate.
Usage:
naval_fate ship new <name>...
naval_fate ship <name> move <x> <y> [--speed=<kn>]
naval_fate ship shoot <x> <y>
naval_fate mine (set|remove) <x> <y> [--moored | --drifting]
naval_fate (-h | --help)
naval_fate --version
Options:
-h --help Show this screen.
--version Show version.
--speed=<kn> Speed in knots [default: 10].
--moored Moored (anchored) mine.
--drifting Drifting mine.
)";
int main(int argc, const char **argv)
{
fmt::print(R"(Version
Major {}
Minor {}
Patch {}
Git Hash {}
)",
Version::Major,
Version::Minor,
Version::Patch,
Version::GitHash);
std::map<std::string, docopt::value> args = docopt::docopt(USAGE,
{ std::next(argv), std::next(argv, argc) },
true,// show help if requested
"Naval Fate 2.0");// version string
for (auto const &arg : args) {
fmt::print(R"(
{} {}
)",
arg.first,
arg.second.asString());
}
// Use the default logger (stdout, multi-threaded, colored)
spdlog::info("Hello, {}!", "World");
fmt::print("Hello, from {}\n", "{fmt}");
}