summaryrefslogtreecommitdiff
path: root/support/latexindent/LatexIndent/LogFile.pm
diff options
context:
space:
mode:
Diffstat (limited to 'support/latexindent/LatexIndent/LogFile.pm')
-rw-r--r--support/latexindent/LatexIndent/LogFile.pm24
1 files changed, 21 insertions, 3 deletions
diff --git a/support/latexindent/LatexIndent/LogFile.pm b/support/latexindent/LatexIndent/LogFile.pm
index 5b44822829..e01792c6fb 100644
--- a/support/latexindent/LatexIndent/LogFile.pm
+++ b/support/latexindent/LatexIndent/LogFile.pm
@@ -28,7 +28,7 @@ sub process_switches{
# -v switch is just to show the version number
if($switches{version}) {
print $versionNumber,", ",$versionDate,"\n";
- exit(2);
+ exit(0);
}
if(scalar(@ARGV) < 1 or $switches{showhelp}) {
@@ -81,9 +81,17 @@ usage: latexindent.pl [options] [file]
-rr, --onlyreplacement
*only* replacement mode, no indentation;
verbatim blocks not respected
+ -k, --check mode
+ will exit with 0 if document body unchanged, 1 if changed
+ -kv, --check mode verbose
+ as in check mode, but outputs diff to screen as well as to logfile
+ -n, --lines=<MIN-MAX>
+ only operate on selected lines; sample usage:
+ latexindent.pl --lines 3-5 myfile.tex
+ latexindent.pl --lines 3-5,7-10 myfile.tex
ENDQUOTE
;
- exit(2);
+ exit(0);
}
# if we've made it this far, the processing of switches and logging begins
@@ -93,7 +101,14 @@ ENDQUOTE
# cruft directory
${$self}{cruftDirectory} = $switches{cruftDirectory}||(dirname ${$self}{fileName});
- die "Could not find directory ${$self}{cruftDirectory}\nExiting, no indentation done." if(!(-d ${$self}{cruftDirectory}));
+
+ # if cruft directory does not exist
+ if(!(-d ${$self}{cruftDirectory})){
+ $logger->fatal("*Could not find directory ${$self}{cruftDirectory}");
+ $logger->fatal("Exiting, no indendation done.");
+ $self->output_logfile();
+ exit(6);
+ }
my $logfileName = ($switches{cruftDirectory} ? ${$self}{cruftDirectory}."/" : '').($switches{logFileName}||"indent.log");
@@ -135,6 +150,9 @@ ENDQUOTE
$logger->info("-c|--cruft: cruft directory") if($switches{cruftDirectory});
$logger->info("-r|--replacement: replacement mode") if($switches{replacement});
$logger->info("-rr|--onlyreplacement: *only* replacement mode, no indentation") if($switches{onlyreplacement});
+ $logger->info("-k|--check mode: will exit with 0 if document body unchanged, 1 if changed") if($switches{check});
+ $logger->info("-kv|--check mode verbose: as in check mode, but outputs diff to screen") if($switches{checkverbose});
+ $logger->info("-n|--lines mode: will only operate on specific lines $switches{lines}") if($switches{lines});
# check if overwrite and outputfile are active similtaneously
if($switches{overwrite} and $switches{outputToFile}){