cli: add message for dry-run option

This commit is contained in:
Dmitriy Pleshevskiy 2022-11-12 16:36:53 +03:00
parent bbd1d47ba5
commit 8f81bddeaa
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -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)