cli: add message for dry-run option
This commit is contained in:
parent
bbd1d47ba5
commit
8f81bddeaa
1 changed files with 4 additions and 0 deletions
|
@ -41,6 +41,10 @@ impl std::error::Error for Error {}
|
||||||
pub fn execute(args: &Args) -> Result<(), Error> {
|
pub fn execute(args: &Args) -> Result<(), Error> {
|
||||||
let content = std::fs::read_to_string(&args.file).map_err(|_| Error::OpenFile)?;
|
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)
|
let fs_writer = (!args.dry_run)
|
||||||
.then(|| {
|
.then(|| {
|
||||||
File::create(args.output.as_ref().unwrap_or(&args.file)).map_err(|_| Error::OpenFile)
|
File::create(args.output.as_ref().unwrap_or(&args.file)).map_err(|_| Error::OpenFile)
|
||||||
|
|
Loading…
Reference in a new issue