mirror of
https://github.com/bkryza/clang-uml.git
synced 2025-05-24 07:41:19 +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()
|
cli_flow_t cli_handler::print_version()
|
||||||
{
|
{
|
||||||
ostr_ << "clang-uml " << clanguml::version::CLANG_UML_VERSION << '\n';
|
ostr_ << "clang-uml " << clanguml::version::CLANG_UML_VERSION << std::endl;
|
||||||
ostr_ << "Copyright (C) 2021-2023 Bartek Kryza <bkryza@gmail.com>" << '\n';
|
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: "
|
ostr_ << "Built against LLVM/Clang libraries version: "
|
||||||
<< LLVM_VERSION_STRING << std::endl;
|
<< LLVM_VERSION_STRING << std::endl;
|
||||||
ostr_ << "Using LLVM/Clang libraries version: "
|
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 {
|
try {
|
||||||
const auto db =
|
const auto db =
|
||||||
clanguml::common::compilation_database::auto_detect_from_directory(
|
common::compilation_database::auto_detect_from_directory(
|
||||||
cli.config);
|
cli.config);
|
||||||
|
|
||||||
const auto compilation_database_files = db->getAllFiles();
|
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
|
// We have to generate the translation units list for each diagram
|
||||||
// before scheduling tasks, because std::filesystem::current_path
|
// before scheduling tasks, because std::filesystem::current_path
|
||||||
// cannot be trusted with multiple threads
|
// 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,
|
cli.diagram_names, cli.config, compilation_database_files,
|
||||||
translation_units_map);
|
translation_units_map);
|
||||||
|
|
||||||
clanguml::common::generators::generate_diagrams(cli.diagram_names,
|
common::generators::generate_diagrams(cli.diagram_names, cli.config,
|
||||||
cli.config, cli.effective_output_directory, db, cli.verbose,
|
cli.effective_output_directory, db, cli.verbose, cli.thread_count,
|
||||||
cli.thread_count, cli.generators, translation_units_map);
|
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: {}",
|
LOG_ERROR("Failed to load compilation database from {} due to: {}",
|
||||||
cli.config.compilation_database_dir(), e.what());
|
cli.config.compilation_database_dir(), e.what());
|
||||||
return 1;
|
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 "
|
LOG_ERROR("Quering provided compiler driver {} did not provide any "
|
||||||
"paths, please make sure the path is correct and that your "
|
"paths, please make sure the path is correct and that your "
|
||||||
"compiler is GCC-compatible: {}",
|
"compiler is GCC-compatible: {}",
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
|
#if __has_include(<sys/utsname.h>)
|
||||||
|
#include <sys/utsname.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace clanguml::util {
|
namespace clanguml::util {
|
||||||
|
|
||||||
@ -124,6 +127,29 @@ std::string get_git_toplevel_dir()
|
|||||||
return trim(get_process_output("git rev-parse --show-toplevel"));
|
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)
|
std::string ltrim(const std::string &s)
|
||||||
{
|
{
|
||||||
const size_t start = s.find_first_not_of(WHITESPACE);
|
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_git_toplevel_dir();
|
||||||
|
|
||||||
|
std::string get_os_name();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Split a string using delimiter
|
* @brief Split a string using delimiter
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user