From 5454bfc02d80d2e96be129fcc1af5125d5652996 Mon Sep 17 00:00:00 2001 From: Humble Penguin Date: Tue, 7 Mar 2023 18:02:05 +0500 Subject: [PATCH 1/4] PR for issue #615 --- src/export/mod.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/export/mod.rs b/src/export/mod.rs index f4f4b45fd..3e102034e 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -1,3 +1,4 @@ +use std::env; use std::fs::{File, OpenOptions}; use std::io::Write; @@ -89,9 +90,19 @@ impl ExportManager { ExportType::Markdown => Box::new(MarkdownExporter::default()), ExportType::Orgmode => Box::new(OrgmodeExporter::default()), }; + self.exporters.push(ExporterWithFilename { exporter, - filename: filename.to_string(), + filename: + if filename == "-" { + if env::consts::OS == "windows" { + "con:".to_string() + } else { + "/dev/stdout".to_string() + } + } else { + filename.to_string() + }, }); Ok(()) From 51cab84a77536ea9f562af52f027f4db12f412ff Mon Sep 17 00:00:00 2001 From: Humble Penguin Date: Tue, 7 Mar 2023 18:04:43 +0500 Subject: [PATCH 2/4] ran cargo fmt --- src/export/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/export/mod.rs b/src/export/mod.rs index 3e102034e..de8ebe820 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -93,8 +93,7 @@ impl ExportManager { self.exporters.push(ExporterWithFilename { exporter, - filename: - if filename == "-" { + filename: if filename == "-" { if env::consts::OS == "windows" { "con:".to_string() } else { From 24c816665fbddb733e0a6d6429277942e12c88ec Mon Sep 17 00:00:00 2001 From: Humble Penguin Date: Mon, 13 Mar 2023 11:39:57 +0500 Subject: [PATCH 3/4] used cfg!(windows) instead of env::consts::OS --- src/export/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/export/mod.rs b/src/export/mod.rs index de8ebe820..2fe674e9d 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -94,7 +94,7 @@ impl ExportManager { self.exporters.push(ExporterWithFilename { exporter, filename: if filename == "-" { - if env::consts::OS == "windows" { + if cfg!(windows) { "con:".to_string() } else { "/dev/stdout".to_string() From 88039dd04123c918ba2fccadff386f731595a057 Mon Sep 17 00:00:00 2001 From: Humble Penguin Date: Mon, 13 Mar 2023 11:40:23 +0500 Subject: [PATCH 4/4] removed unused imports --- src/export/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/export/mod.rs b/src/export/mod.rs index 2fe674e9d..db85eacaf 100644 --- a/src/export/mod.rs +++ b/src/export/mod.rs @@ -1,4 +1,3 @@ -use std::env; use std::fs::{File, OpenOptions}; use std::io::Write;