Added --dump-config command line option (Fixes #77)

This commit is contained in:
Bartek Kryza
2023-01-17 23:43:44 +01:00
parent 74353603f8
commit 00b9321034
10 changed files with 1106 additions and 606 deletions

View File

@@ -187,4 +187,30 @@ TEST_CASE("Test config layout", "[unit-test]")
check_layout(static_cast<clanguml::config::package_diagram &>(
*cfg.diagrams["package_main"]),
clanguml::common::model::diagram_t::kPackage);
}
TEST_CASE("Test config emitters", "[unit-test]")
{
auto cfg = clanguml::config::load("./test_config_data/complete.yml");
YAML::Emitter out;
out.SetIndent(2);
out << cfg;
out << YAML::Newline;
// Write the emitted YAML to a temp file
auto tmp_file = std::filesystem::temp_directory_path() /
fmt::format("clang-uml-{:16}", rand());
{
std::ofstream stream(tmp_file.string().c_str(), std::ios::binary);
stream << out.c_str();
}
auto cfg_emitted = clanguml::config::load(tmp_file.string());
REQUIRE(cfg.diagrams.size() == cfg_emitted.diagrams.size());
std::filesystem::remove(tmp_file);
}

View File

@@ -0,0 +1,61 @@
# Directory containing the compile_commands.json file
compilation_database_dir: debug
# The directory where *.puml files will be generated
output_directory: docs/diagrams
# Set this as default for all diagrams
generate_method_arguments: none
# Enable generation of hyperlinks to diagram elements
generate_links:
# Link pattern
link: "https://github.com/bkryza/clang-uml/blob/{{ git.commit }}/{{ element.source.path }}#L{{ element.source.line }}"
# Tooltip pattern
tooltip: "{{ element.name }}"
# The map of diagrams - keys are also diagram file names
diagrams:
config_class:
type: class
# Do not include rendered relations in the class box
include_relations_also_as_members: false
# Limiting the number of files to include can significantly
# improve the generation time
glob:
- src/common/model/*.h
- src/common/model/*.cc
- src/class_diagram/model/*.h
- src/class_diagram/model/*.cc
include:
# Only include entities from the following namespaces
namespaces:
- clanguml::common::model
- clanguml::class_diagram::model
# Only include elements in direct relationship with ClassA
context:
- ClassA
exclude:
# Do not include private members and methods in the diagram
access:
- private
layout:
# Add layout hints for PlantUML
ClassA:
- up: ClassB
- left: ClassC
# Specify customized relationship hints for types which are
# arguments in template instantiations
relationship_hints:
# All tuple arguments should be treated as aggregation
std::tuple: aggregation
# All some_template arguments should be treated as associations
# except for arguments with indexes 2 and 10
ns1::n2::some_template:
default: association
2: composition
10: aggregation
# Entities from this namespace will be shortened
# (can only contain one element at the moment)
using_namespace:
- clanguml::class_diagram::model
plantuml:
# Add this line to the beginning of the resulting puml file
before:
- 'title clang-uml class diagram model'