From e511d215beec0c1f501604fa317b721937bd3b8c Mon Sep 17 00:00:00 2001 From: Lynnesbian Date: Fri, 18 Jun 2021 17:42:16 +1000 Subject: [PATCH] minor bash/pwsh output changes - bash now uses a heredoc to ensure that cheeky filenames containing linebreaks don't escape the echo string - powershell rename-item now has the verbose flag that i didn't know existed - there is now a newline between the error and successful output lines --- src/formats.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/formats.rs b/src/formats.rs index 4b41827..7f56b22 100644 --- a/src/formats.rs +++ b/src/formats.rs @@ -167,6 +167,12 @@ pub trait Format { } } + if findings.len() != entries.len() { + // if these lengths aren't the same, there was at least one error + // add a blank line between the errors and commands + smart_write(f, writables![Newline])?; + } + for finding in findings { if let Some(ext) = finding.recommended_extension() { self.rename(f, finding.file.as_path(), &finding.file.with_extension(ext.as_str()))?; @@ -190,7 +196,7 @@ impl Format for Shell { } fn no_known_extension(&self, f: &mut W, path: &Path) -> io::Result<()> { - smart_write(f, writablesln!["echo No known extension for ", path]) + smart_write(f, writablesln!["cat <<- '???'", Newline, "No known extension for ", path, Newline, "???"]) } fn unreadable(&self, f: &mut W, path: &Path) -> io::Result<()> { @@ -233,7 +239,7 @@ impl Format for PowerShell { // there doesn't seem to be a way to rename the file, prompting only if the target already exists. smart_write( f, - writablesln!["Rename-Item -Path ", from, " -NewName ", (to.file_name().unwrap())], + writablesln!["Rename-Item -Verbose -Path ", from, " -NewName ", (to.file_name().unwrap())], ) }