Command line options handler. More...
Command line options handler.
This class is responsible for handling the command line options and executing required actions.
Definition at line 60 of file cli_handler.h.
#include <cli_handler.h>
Public Member Functions | |
cli_handler (std::ostream &ostr=std::cout, std::shared_ptr< spdlog::logger > logger=spdlog::stdout_color_mt("clanguml-logger", spdlog::color_mode::automatic)) | |
cli_flow_t | handle_options (int argc, const char **argv) |
cli_flow_t | print_version () |
cli_flow_t | print_diagrams_list () |
cli_flow_t | print_diagram_templates () |
cli_flow_t | print_diagram_template (const std::string &template_name) |
cli_flow_t | print_config () |
cli_flow_t | create_config_file () |
cli_flow_t | add_config_diagram (clanguml::common::model::diagram_t type, const std::string &config_file_path, const std::string &name) |
cli_flow_t | add_config_diagram_from_template (const std::string &config_file_path, const std::string &template_name) |
cli_flow_t | render_diagram_template (const std::string &template_name, YAML::Node &diagram_node) |
cli_flow_t | generate_diagram_from_template (const std::string &template_name) |
bool | ensure_output_directory_exists (const std::string &dir) |
runtime_config | get_runtime_config () const |
Combines runtime configuration parameters into a single structure. | |
void | set_config_path (const std::string &path) |
Set the default config path. | |
Static Public Member Functions | |
static void | create_json_progress_logger (spdlog::sink_ptr sink={}) |
Public Attributes | |
std::string | config_path {".clang-uml"} |
std::optional< std::string > | compilation_database_dir {} |
std::vector< std::string > | diagram_names {} |
std::optional< std::string > | output_directory {} |
std::string | effective_output_directory {} |
unsigned int | thread_count {} |
bool | show_version {false} |
int | verbose {} |
logging::logger_type_t | logger_type {logging::logger_type_t::text} |
bool | progress {false} |
bool | list_diagrams {false} |
bool | quiet {false} |
bool | initialize {false} |
bool | allow_empty_diagrams {false} |
std::optional< std::vector< std::string > > | add_compile_flag |
std::optional< std::vector< std::string > > | remove_compile_flag |
std::vector< std::pair< std::string, std::string > > | user_data |
std::optional< std::string > | query_driver |
std::optional< std::string > | add_class_diagram |
std::optional< std::string > | add_sequence_diagram |
std::optional< std::string > | add_package_diagram |
std::optional< std::string > | add_include_diagram |
std::optional< std::string > | add_diagram_from_template |
std::optional< std::string > | generate_from_template |
bool | dump_config {false} |
bool | print_from {false} |
bool | print_to {false} |
std::optional< bool > | paths_relative_to_pwd {} |
std::vector< std::string > | template_variables {} |
bool | list_templates {false} |
std::optional< bool > | no_metadata {} |
std::optional< std::string > | show_template |
std::vector< clanguml::common::generator_type_t > | generators |
bool | no_validate {false} |
bool | validate_only {false} |
bool | render_diagrams {false} |
std::optional< std::string > | plantuml_cmd |
std::optional< std::string > | mermaid_cmd |
clanguml::config::config | config |
Private Member Functions | |
cli_flow_t | parse (int argc, const char **argv) |
cli_flow_t | handle_pre_config_options () |
cli_flow_t | load_config () |
cli_flow_t | handle_post_config_options () |
cli_flow_t | add_custom_user_data () |
void | setup_logging () |
Private Attributes | |
std::ostream & | ostr_ |
std::shared_ptr< spdlog::logger > | logger_ |
CLI::App | app {"Clang-based UML diagram generator for C++"} |
clanguml::cli::cli_handler::cli_handler | ( | std::ostream & | ostr = std::cout , |
std::shared_ptr< spdlog::logger > | logger = spdlog::stdout_color_mt( "clanguml-logger", spdlog::color_mode::automatic) |
||
) |
Definition at line 27 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::add_config_diagram | ( | clanguml::common::model::diagram_t | type, |
const std::string & | config_file_path, | ||
const std::string & | name | ||
) |
Add example diagram of given type to the config file.
type | Type of the sample diagram to add |
config_file_path | Path to the config file |
name | Name of the new diagram |
Definition at line 653 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::add_config_diagram_from_template | ( | const std::string & | config_file_path, |
const std::string & | template_name | ||
) |
Add diagram based on template
config_file_path | Path to the configuration file |
template_name | Name of the diagram template |
Definition at line 781 of file cli_handler.cc.
|
private |
Handle custom Jinja context user data provider through --user-data
Definition at line 855 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::create_config_file | ( | ) |
Generate sample configuration file and exit.
Definition at line 603 of file cli_handler.cc.
|
static |
Definition at line 67 of file cli_handler.cc.
bool clanguml::cli::cli_handler::ensure_output_directory_exists | ( | const std::string & | dir | ) |
Check if diagram output directory exists, if not create it
dir | Path to the output directory |
Definition at line 499 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::generate_diagram_from_template | ( | const std::string & | template_name | ) |
Generate diagram based on template
template_name | Name of the diagram template |
Definition at line 817 of file cli_handler.cc.
runtime_config clanguml::cli::cli_handler::get_runtime_config | ( | ) | const |
Combines runtime configuration parameters into a single structure.
Definition at line 454 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::handle_options | ( | int | argc, |
const char ** | argv | ||
) |
Main CLI handling method.
argc | |
argv |
Definition at line 228 of file cli_handler.cc.
|
private |
Handle command line options before parsing the configuration file
Definition at line 353 of file cli_handler.cc.
|
private |
Handle command line options before parsing the configuration file
Definition at line 264 of file cli_handler.cc.
|
private |
Load configuration file from file or stdin
Definition at line 324 of file cli_handler.cc.
|
private |
This method parses the command line options using CLI11 library.
argc | |
argv |
Definition at line 86 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::print_config | ( | ) |
Print effective config after loading and setting default values.
Definition at line 842 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::print_diagram_template | ( | const std::string & | template_name | ) |
Print definition of a specific diagram template.
template_name | Name of the diagram template |
Definition at line 585 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::print_diagram_templates | ( | ) |
Print list of available diagram templates, including their names and types.
Definition at line 545 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::print_diagrams_list | ( | ) |
Print list of diagrams available in the configuration file
Definition at line 518 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::print_version | ( | ) |
Print the program version and basic information
Definition at line 474 of file cli_handler.cc.
cli_flow_t clanguml::cli::cli_handler::render_diagram_template | ( | const std::string & | template_name, |
YAML::Node & | diagram_node | ||
) |
Render diagram template
template_name | Template name |
diagram_node | Reference to YAML output node |
Definition at line 737 of file cli_handler.cc.
void clanguml::cli::cli_handler::set_config_path | ( | const std::string & | path | ) |
|
private |
Setup spdlog library depending on provided command line options
Definition at line 34 of file cli_handler.cc.
std::optional<std::string> clanguml::cli::cli_handler::add_class_diagram |
Definition at line 204 of file cli_handler.h.
std::optional<std::vector<std::string> > clanguml::cli::cli_handler::add_compile_flag |
Definition at line 198 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::add_diagram_from_template |
Definition at line 208 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::add_include_diagram |
Definition at line 207 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::add_package_diagram |
Definition at line 206 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::add_sequence_diagram |
Definition at line 205 of file cli_handler.h.
bool clanguml::cli::cli_handler::allow_empty_diagrams {false} |
Definition at line 197 of file cli_handler.h.
|
private |
Definition at line 273 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::compilation_database_dir {} |
Definition at line 185 of file cli_handler.h.
clanguml::config::config clanguml::cli::cli_handler::config |
Definition at line 226 of file cli_handler.h.
std::string clanguml::cli::cli_handler::config_path {".clang-uml"} |
Definition at line 184 of file cli_handler.h.
std::vector<std::string> clanguml::cli::cli_handler::diagram_names {} |
Definition at line 186 of file cli_handler.h.
bool clanguml::cli::cli_handler::dump_config {false} |
Definition at line 210 of file cli_handler.h.
std::string clanguml::cli::cli_handler::effective_output_directory {} |
Definition at line 188 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::generate_from_template |
Definition at line 209 of file cli_handler.h.
std::vector<clanguml::common::generator_type_t> clanguml::cli::cli_handler::generators |
Definition at line 218 of file cli_handler.h.
bool clanguml::cli::cli_handler::initialize {false} |
Definition at line 196 of file cli_handler.h.
bool clanguml::cli::cli_handler::list_diagrams {false} |
Definition at line 194 of file cli_handler.h.
bool clanguml::cli::cli_handler::list_templates {false} |
Definition at line 215 of file cli_handler.h.
|
private |
Definition at line 272 of file cli_handler.h.
logging::logger_type_t clanguml::cli::cli_handler::logger_type {logging::logger_type_t::text} |
Definition at line 192 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::mermaid_cmd |
Definition at line 224 of file cli_handler.h.
std::optional<bool> clanguml::cli::cli_handler::no_metadata {} |
Definition at line 216 of file cli_handler.h.
bool clanguml::cli::cli_handler::no_validate {false} |
Definition at line 220 of file cli_handler.h.
|
private |
Definition at line 271 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::output_directory {} |
Definition at line 187 of file cli_handler.h.
std::optional<bool> clanguml::cli::cli_handler::paths_relative_to_pwd {} |
Definition at line 213 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::plantuml_cmd |
Definition at line 223 of file cli_handler.h.
bool clanguml::cli::cli_handler::print_from {false} |
Definition at line 211 of file cli_handler.h.
bool clanguml::cli::cli_handler::print_to {false} |
Definition at line 212 of file cli_handler.h.
bool clanguml::cli::cli_handler::progress {false} |
Definition at line 193 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::query_driver |
Definition at line 202 of file cli_handler.h.
bool clanguml::cli::cli_handler::quiet {false} |
Definition at line 195 of file cli_handler.h.
std::optional<std::vector<std::string> > clanguml::cli::cli_handler::remove_compile_flag |
Definition at line 199 of file cli_handler.h.
bool clanguml::cli::cli_handler::render_diagrams {false} |
Definition at line 222 of file cli_handler.h.
std::optional<std::string> clanguml::cli::cli_handler::show_template |
Definition at line 217 of file cli_handler.h.
bool clanguml::cli::cli_handler::show_version {false} |
Definition at line 190 of file cli_handler.h.
std::vector<std::string> clanguml::cli::cli_handler::template_variables {} |
Definition at line 214 of file cli_handler.h.
unsigned int clanguml::cli::cli_handler::thread_count {} |
Definition at line 189 of file cli_handler.h.
std::vector<std::pair<std::string, std::string> > clanguml::cli::cli_handler::user_data |
Definition at line 200 of file cli_handler.h.
bool clanguml::cli::cli_handler::validate_only {false} |
Definition at line 221 of file cli_handler.h.
int clanguml::cli::cli_handler::verbose {} |
Definition at line 191 of file cli_handler.h.