Skip to content

Commit

Permalink
refactor(log): change starting character for each log type (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
rlespinasse authored Mar 26, 2024
1 parent fb80644 commit 9d428cc
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 132 deletions.
8 changes: 4 additions & 4 deletions src/drawio_exporter/ops/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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!(
Expand Down
72 changes: 36 additions & 36 deletions tests/commands/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions tests/commands/exporter_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/exporter_option_git_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 24 additions & 24 deletions tests/commands/exporter_option_on_changes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions tests/commands/exporter_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit 9d428cc

Please sign in to comment.