mirror of
https://github.com/bkryza/clang-uml.git
synced 2025-05-22 14:32:46 +08:00
Added OS details information in version help message
This commit is contained in:
parent
0a4e2c8855
commit
ac01127436
@ -305,8 +305,10 @@ cli_flow_t cli_handler::handle_post_config_options()
|
||||
|
||||
cli_flow_t cli_handler::print_version()
|
||||
{
|
||||
ostr_ << "clang-uml " << clanguml::version::CLANG_UML_VERSION << '\n';
|
||||
ostr_ << "Copyright (C) 2021-2023 Bartek Kryza <bkryza@gmail.com>" << '\n';
|
||||
ostr_ << "clang-uml " << clanguml::version::CLANG_UML_VERSION << std::endl;
|
||||
ostr_ << "Copyright (C) 2021-2023 Bartek Kryza <bkryza@gmail.com>"
|
||||
<< std::endl;
|
||||
ostr_ << util::get_os_name() << std::endl;
|
||||
ostr_ << "Built against LLVM/Clang libraries version: "
|
||||
<< LLVM_VERSION_STRING << std::endl;
|
||||
ostr_ << "Using LLVM/Clang libraries version: "
|
||||
|
14
src/main.cc
14
src/main.cc
@ -61,7 +61,7 @@ int main(int argc, const char *argv[])
|
||||
|
||||
try {
|
||||
const auto db =
|
||||
clanguml::common::compilation_database::auto_detect_from_directory(
|
||||
common::compilation_database::auto_detect_from_directory(
|
||||
cli.config);
|
||||
|
||||
const auto compilation_database_files = db->getAllFiles();
|
||||
@ -73,20 +73,20 @@ int main(int argc, const char *argv[])
|
||||
// We have to generate the translation units list for each diagram
|
||||
// before scheduling tasks, because std::filesystem::current_path
|
||||
// cannot be trusted with multiple threads
|
||||
clanguml::common::generators::find_translation_units_for_diagrams(
|
||||
common::generators::find_translation_units_for_diagrams(
|
||||
cli.diagram_names, cli.config, compilation_database_files,
|
||||
translation_units_map);
|
||||
|
||||
clanguml::common::generators::generate_diagrams(cli.diagram_names,
|
||||
cli.config, cli.effective_output_directory, db, cli.verbose,
|
||||
cli.thread_count, cli.generators, translation_units_map);
|
||||
common::generators::generate_diagrams(cli.diagram_names, cli.config,
|
||||
cli.effective_output_directory, db, cli.verbose, cli.thread_count,
|
||||
cli.generators, translation_units_map);
|
||||
}
|
||||
catch (clanguml::common::compilation_database_error &e) {
|
||||
catch (common::compilation_database_error &e) {
|
||||
LOG_ERROR("Failed to load compilation database from {} due to: {}",
|
||||
cli.config.compilation_database_dir(), e.what());
|
||||
return 1;
|
||||
}
|
||||
catch (clanguml::util::query_driver_no_paths &e) {
|
||||
catch (util::query_driver_no_paths &e) {
|
||||
LOG_ERROR("Quering provided compiler driver {} did not provide any "
|
||||
"paths, please make sure the path is correct and that your "
|
||||
"compiler is GCC-compatible: {}",
|
||||
|
@ -20,6 +20,9 @@
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include <regex>
|
||||
#if __has_include(<sys/utsname.h>)
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
namespace clanguml::util {
|
||||
|
||||
@ -124,6 +127,29 @@ std::string get_git_toplevel_dir()
|
||||
return trim(get_process_output("git rev-parse --show-toplevel"));
|
||||
}
|
||||
|
||||
std::string get_os_name()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return "Windows, 32-bit";
|
||||
#elif _WIN64
|
||||
return "Windows, 64-bit";
|
||||
#elif __has_include(<sys/utsname.h>)
|
||||
utsname utsn;
|
||||
uname(&utsn);
|
||||
return fmt::format("{} {} {}", utsn.sysname, utsn.machine, utsn.release);
|
||||
#elif __linux__
|
||||
return "Linux";
|
||||
#elif __APPLE__ || __MACH__
|
||||
return "macOS";
|
||||
#elif __FreeBSD__
|
||||
return "FreeBSD";
|
||||
#elif __unix__ || __unix
|
||||
return "Unix";
|
||||
#else
|
||||
return "Unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string ltrim(const std::string &s)
|
||||
{
|
||||
const size_t start = s.find_first_not_of(WHITESPACE);
|
||||
|
@ -76,6 +76,8 @@ std::string get_git_commit();
|
||||
|
||||
std::string get_git_toplevel_dir();
|
||||
|
||||
std::string get_os_name();
|
||||
|
||||
/**
|
||||
* @brief Split a string using delimiter
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user