diff options
author | Karl Berry <karl@freefriends.org> | 2021-09-16 20:17:39 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-09-16 20:17:39 +0000 |
commit | fd4d90b5caf562a8d951bb4a3b78a1aa74930017 (patch) | |
tree | 0149dcc8db072610a3563e4de0d64059b7d3a4e1 /Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm | |
parent | d1b9b9a5605416852eda15bb968ab490d42b47cf (diff) |
latexindent (16sep21)
git-svn-id: svn://tug.org/texlive/trunk@60522 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm')
-rw-r--r-- | Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm b/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm index 5b44822829d..e01792c6fb5 100644 --- a/Master/texmf-dist/scripts/latexindent/LatexIndent/LogFile.pm +++ b/Master/texmf-dist/scripts/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}){ |