diff --git a/LatexIndent/Document.pm b/LatexIndent/Document.pm index 34eb1691..e182f4ba 100644 --- a/LatexIndent/Document.pm +++ b/LatexIndent/Document.pm @@ -112,6 +112,7 @@ sub latexindent{ # overwrite and overwriteIfDifferent switches, per file ${$self}{overwrite} = $switches{overwrite}; ${$self}{overwriteIfDifferent} = $switches{overwriteIfDifferent}; + ${$self}{overwriteWithoutBackup} = $switches{overwriteWithoutBackup}; # the main operations $self->operate_on_file; @@ -211,7 +212,7 @@ sub output_indented_text{ $logger->info("*Output routine:"); # if -overwrite is active then output to original fileName - if(${$self}{overwrite}){ + if(${$self}{overwrite} || ${$self}{overwriteWithoutBackup}){ $logger->info("Overwriting file ${$self}{fileName}"); open(OUTPUTFILE,">",${$self}{fileName}); print OUTPUTFILE ${$self}{body}; diff --git a/LatexIndent/LogFile.pm b/LatexIndent/LogFile.pm index fa6df788..2c4dfde7 100644 --- a/LatexIndent/LogFile.pm +++ b/LatexIndent/LogFile.pm @@ -64,6 +64,8 @@ usage: latexindent.pl [options] [file] -wd, --overwriteIfDifferent overwrite the current file IF the indented text is different from original; a backup will be made, but still be careful + --overwriteWithoutBackup + overwrite the current file; NO BACKUP WILL BE MADE, USE AT YOUR OWN RISK! -s, --silent silent mode: no output will be given to the terminal -t, --trace diff --git a/latexindent.pl b/latexindent.pl index 09134e96..e47967b5 100755 --- a/latexindent.pl +++ b/latexindent.pl @@ -40,6 +40,7 @@ "onlydefault|d"=>\$switches{onlyDefault}, "overwrite|w"=>\$switches{overwrite}, "overwriteIfDifferent|wd"=>\$switches{overwriteIfDifferent}, + "overwriteWithoutBackup"=>\$switches{overwriteWithoutBackup}, "outputfile|o=s"=>\$switches{outputToFile}, "modifylinebreaks|m"=>\$switches{modifyLineBreaks}, "logfile|g=s"=>\$switches{logFileName},