main.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
55
56
57
58
59
60
61
62
63
64
#include "crucible/boot/main.hpp" #include "crucible/core/memory.hpp" #include "crucible/core/string.hpp" #include <iostream> #include <string> namespace crucible::identify::main { namespace internal { constexpr char const BULLET[] { "•" }; constexpr char const GREEN[] { "\x1b[0;32m" }; constexpr char const MAGENTA[] { "\x1b[0;35m" }; constexpr char const BRIGHT[] { "\x1b[1m" }; constexpr char const RESET[] { "\x1b[0m" }; [[nodiscard]] auto replicate(std::string const &pattern, std::size_t const amount) -> std::string { std::string result {}; for (std::size_t i { 0 }; i < amount; ++i) { result += pattern; } return result; } } auto launch(core::memory::ImmutableView<core::string::String> const &arguments) -> boot::main::ExitStatus { static_cast<void>(arguments); std::string const full_header { "crucible-identify v" CRUCIBLE_VERSION }; std::size_t const space_required { full_header.size() + 2 }; std::string const horizontal_bars { internal::replicate("─", space_required) }; std::cout << "\n" << internal::BRIGHT << "╭" << horizontal_bars << "╮\n" << internal::RESET << internal::BRIGHT << "│ " << full_header << " │\n" << internal::RESET << internal::BRIGHT << "╰" << horizontal_bars << "╯\n" << internal::RESET << "\n" << internal::BRIGHT << "Build information\n" << internal::RESET << internal::BRIGHT << "─────────────────\n" << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "CMake version" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_CMAKE_VERSION << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "C++ compiler" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_CXX_COMPILER_ID << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "C++ compiler version" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_CXX_COMPILER_VERSION << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "Architecture" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_TARGET_SYSTEM_ARCHITECTURE << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "Host" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_TARGET_SYSTEM_ID << internal::RESET << "\n" << internal::BULLET << " " << internal::MAGENTA << "Host version" << internal::RESET << " is " << internal::GREEN << CRUCIBLE_TARGET_SYSTEM_VERSION << internal::RESET << "\n" << "\n"; return boot::main::ExitStatus::Success; } } CRUCIBLE_MAIN(::crucible::identify::main::launch)