From 8f81bddeaaee7be91a419f10df02eff366478ade Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 12 Nov 2022 16:36:53 +0300 Subject: [PATCH] cli: add message for dry-run option --- src/cli/switch.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cli/switch.rs b/src/cli/switch.rs index b20f699..dcfd6d6 100644 --- a/src/cli/switch.rs +++ b/src/cli/switch.rs @@ -41,6 +41,10 @@ impl std::error::Error for Error {} pub fn execute(args: &Args) -> Result<(), Error> { let content = std::fs::read_to_string(&args.file).map_err(|_| Error::OpenFile)?; + if args.dry_run { + println!("Your file will be changed to the following") + } + let fs_writer = (!args.dry_run) .then(|| { File::create(args.output.as_ref().unwrap_or(&args.file)).map_err(|_| Error::OpenFile)