From 9d428cc77dedb16e88f5f57958978d5c69f1e604 Mon Sep 17 00:00:00 2001 From: Romain Lespinasse Date: Tue, 26 Mar 2024 07:41:31 +0100 Subject: [PATCH] refactor(log): change starting character for each log type (#54) --- src/drawio_exporter/ops/exporter.rs | 8 +- tests/commands/exporter.rs | 72 +++++++++--------- tests/commands/exporter_links.rs | 32 ++++---- tests/commands/exporter_option_git_ref.rs | 8 +- tests/commands/exporter_option_on_changes.rs | 48 ++++++------ tests/commands/exporter_options.rs | 16 ++-- tests/commands/exporter_types.rs | 80 ++++++++++---------- 7 files changed, 132 insertions(+), 132 deletions(-) diff --git a/src/drawio_exporter/ops/exporter.rs b/src/drawio_exporter/ops/exporter.rs index 8831064..8516c6a 100644 --- a/src/drawio_exporter/ops/exporter.rs +++ b/src/drawio_exporter/ops/exporter.rs @@ -71,7 +71,7 @@ pub fn exporter(options: ExporterOptions<'_>) -> Result<()> { let with_page_suffix = !(options.remove_page_suffix && mxfile.diagrams.len() == 1); for (position, diagram) in mxfile.diagrams.iter().enumerate() { let position_to_display = position + 1; - println!("++ export page {} : {}", position_to_display, diagram.name); + println!("- export page {} : {}", position_to_display, diagram.name); let file_stem = path.file_stem().unwrap(); let file_stem_suffix = match with_page_suffix { @@ -98,7 +98,7 @@ pub fn exporter(options: ExporterOptions<'_>) -> Result<()> { .join(options.folder) .join(&output_filename); - println!("+++ generate {} file", real_format); + println!("\\ generate {} file", real_format); drawio_desktop.execute(ExportArguments { recursive: false, @@ -145,7 +145,7 @@ fn generate_formatted_text_file( file_stem_suffix: String, output_filename: String, ) -> Result<()> { - println!("+++ generate {} file", options.format); + println!("\\ generate {} file", options.format); let formatted_text_filename = format!( "{}{}.{}", file_stem.to_str().unwrap(), @@ -187,7 +187,7 @@ image::{}[{}] )?; } - println!("+++ include links in {} file", options.format); + println!("\\ include links in {} file", options.format); for (link, label) in diagram.get_links() { if label.is_empty() { println!( diff --git a/tests/commands/exporter.rs b/tests/commands/exporter.rs index 9ac9c8d..8076857 100644 --- a/tests/commands/exporter.rs +++ b/tests/commands/exporter.rs @@ -22,11 +22,11 @@ fn export_files_with_a_name_collision() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("name_collision", true)?; let output = "+ export file : name_collision/name-collision.drawio -++ export page 1 : Page-1 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file + export file : name_collision/name.drawio -++ export page 1 : Page-1 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file"; drawio_exporter .cmd @@ -43,25 +43,25 @@ fn export_files_from_a_folders_tree() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("tree", true)?; let output = "+ export file : tree/file1.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder1/file2.1.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder1/file2.2.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder2/folder3/file3.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd @@ -78,10 +78,10 @@ fn export_file_with_spaces() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("space", true)?; let output = "+ export file : space/file with spaces.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd @@ -98,14 +98,14 @@ fn export_file_using_shapes() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("shapes", true)?; let output = "+ export file : shapes/shapes.drawio -++ export page 1 : AWS -+++ generate pdf file -++ export page 2 : Azure -+++ generate pdf file -++ export page 3 : GCP -+++ generate pdf file -++ export page 4 : K8S -+++ generate pdf file"; +- export page 1 : AWS +\\ generate pdf file +- export page 2 : Azure +\\ generate pdf file +- export page 3 : GCP +\\ generate pdf file +- export page 4 : K8S +\\ generate pdf file"; drawio_exporter .cmd @@ -138,10 +138,10 @@ fn export_file_from_vscode() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("vscode", true)?; let output = "+ export file : vscode/vscode.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page-2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page-2 +\\ generate pdf file"; drawio_exporter .cmd diff --git a/tests/commands/exporter_links.rs b/tests/commands/exporter_links.rs index 54cd07f..c277cf5 100644 --- a/tests/commands/exporter_links.rs +++ b/tests/commands/exporter_links.rs @@ -8,30 +8,30 @@ fn export_links_when_adoc_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("links", true)?; let output = "+ export file : links/links.drawio -++ export page 1 : Page-1 -+++ generate png file -+++ generate adoc file -+++ include links in adoc file +- export page 1 : Page-1 +\\ generate png file +\\ generate adoc file +\\ include links in adoc file warn: link not included, page link isn't supported, link 'Text Page Link 1' to data:page/id,ywT4ct3H2L5pf33UiNoI warn: link not included, page link isn't supported, link 'Shape Page Link 1' to data:page/id,ywT4ct3H2L5pf33UiNoI link 'Text Link 1' to https://github.com/rlespinasse/drawio-exporter link 'Shape Link 1' to https://github.com/rlespinasse/drawio-exporter -++ export page 2 : Page-2 -+++ generate png file -+++ generate adoc file -+++ include links in adoc file +- export page 2 : Page-2 +\\ generate png file +\\ generate adoc file +\\ include links in adoc file warn: link not included, page link isn't supported, link 'Text Page Link 1' to data:page/id,Apcybv1_2TdogQw9BSl8 warn: link not included, page link isn't supported, link 'Shape Page Link 1' to data:page/id,Apcybv1_2TdogQw9BSl8 link 'Link on multiple Lines' to https://github.com/rlespinasse/drawio-exporter -++ export page 3 : empty-link -+++ generate png file -+++ generate adoc file -+++ include links in adoc file +- export page 3 : empty-link +\\ generate png file +\\ generate adoc file +\\ include links in adoc file warn: link not included, due to missing url: link 'Empty Link' to [missing] -++ export page 4 : empty-text -+++ generate png file -+++ generate adoc file -+++ include links in adoc file +- export page 4 : empty-text +\\ generate png file +\\ generate adoc file +\\ include links in adoc file warn: link not included, due to missing label: link '[missing]' to https://github.com/rlespinasse/drawio-exporter"; drawio_exporter diff --git a/tests/commands/exporter_option_git_ref.rs b/tests/commands/exporter_option_git_ref.rs index 6aba9dd..3d1e9d0 100644 --- a/tests/commands/exporter_option_git_ref.rs +++ b/tests/commands/exporter_option_git_ref.rs @@ -102,10 +102,10 @@ fn export_using_option_git_ref_with_value_root_commit_sha1() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : nominal.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd diff --git a/tests/commands/exporter_option_on_changes.rs b/tests/commands/exporter_option_on_changes.rs index f1afd63..5cf9809 100644 --- a/tests/commands/exporter_option_on_changes.rs +++ b/tests/commands/exporter_option_on_changes.rs @@ -11,25 +11,25 @@ fn export_only_changed_files() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("tree", false)?; let output_first_run = "+ export file : tree/file1.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder1/file2.1.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder1/file2.2.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder2/folder3/file3.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd @@ -61,15 +61,15 @@ fn export_only_changed_files() -> Result<()> { )?; let output_second_run = "+ export file : tree/file1.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file + export file : tree/folder1/file2.2.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter.new_cmd()?; drawio_exporter diff --git a/tests/commands/exporter_options.rs b/tests/commands/exporter_options.rs index 616876c..cd64bad 100644 --- a/tests/commands/exporter_options.rs +++ b/tests/commands/exporter_options.rs @@ -8,8 +8,8 @@ fn export_single_diagram_file_with_no_option_remove_page_suffix() -> Result<()> let mut drawio_exporter = DrawioExporterCommand::new_using_data("single_page", true)?; let output = "+ export file : single_page/single-page.drawio -++ export page 1 : Page-1 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file"; drawio_exporter .cmd @@ -26,8 +26,8 @@ fn export_single_diagram_file_with_option_remove_page_suffix() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("single_page", true)?; let output = "+ export file : single_page/single-page.drawio -++ export page 1 : Page-1 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file"; drawio_exporter .cmd @@ -45,10 +45,10 @@ fn export_using_specific_path() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : nominal.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd diff --git a/tests/commands/exporter_types.rs b/tests/commands/exporter_types.rs index 2402554..13781f2 100644 --- a/tests/commands/exporter_types.rs +++ b/tests/commands/exporter_types.rs @@ -8,10 +8,10 @@ fn export_default_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd @@ -28,14 +28,14 @@ fn export_adoc_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate png file -+++ generate adoc file -+++ include links in adoc file -++ export page 2 : Page 2 -+++ generate png file -+++ generate adoc file -+++ include links in adoc file"; +- export page 1 : Page-1 +\\ generate png file +\\ generate adoc file +\\ include links in adoc file +- export page 2 : Page 2 +\\ generate png file +\\ generate adoc file +\\ include links in adoc file"; drawio_exporter .cmd @@ -54,14 +54,14 @@ fn export_md_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate png file -+++ generate md file -+++ include links in md file -++ export page 2 : Page 2 -+++ generate png file -+++ generate md file -+++ include links in md file"; +- export page 1 : Page-1 +\\ generate png file +\\ generate md file +\\ include links in md file +- export page 2 : Page 2 +\\ generate png file +\\ generate md file +\\ include links in md file"; drawio_exporter .cmd @@ -80,10 +80,10 @@ fn export_pdf_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate pdf file -++ export page 2 : Page 2 -+++ generate pdf file"; +- export page 1 : Page-1 +\\ generate pdf file +- export page 2 : Page 2 +\\ generate pdf file"; drawio_exporter .cmd @@ -102,10 +102,10 @@ fn export_png_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate png file -++ export page 2 : Page 2 -+++ generate png file"; +- export page 1 : Page-1 +\\ generate png file +- export page 2 : Page 2 +\\ generate png file"; drawio_exporter .cmd @@ -124,10 +124,10 @@ fn export_xml_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate xml file -++ export page 2 : Page 2 -+++ generate xml file"; +- export page 1 : Page-1 +\\ generate xml file +- export page 2 : Page 2 +\\ generate xml file"; drawio_exporter .cmd @@ -146,10 +146,10 @@ fn export_svg_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate svg file -++ export page 2 : Page 2 -+++ generate svg file"; +- export page 1 : Page-1 +\\ generate svg file +- export page 2 : Page 2 +\\ generate svg file"; drawio_exporter .cmd @@ -168,10 +168,10 @@ fn export_vsdx_format() -> Result<()> { let mut drawio_exporter = DrawioExporterCommand::new_using_data("types", true)?; let output = "+ export file : types/nominal.drawio -++ export page 1 : Page-1 -+++ generate vsdx file -++ export page 2 : Page 2 -+++ generate vsdx file"; +- export page 1 : Page-1 +\\ generate vsdx file +- export page 2 : Page 2 +\\ generate vsdx file"; drawio_exporter .cmd