diff options
6 files changed, 150 insertions, 48 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/pdftex-quiet/pdftex-quiet b/Build/source/texk/texlive/linked_scripts/pdftex-quiet/pdftex-quiet index 6a12b2eeb7d..7bf4599c71b 100755 --- a/Build/source/texk/texlive/linked_scripts/pdftex-quiet/pdftex-quiet +++ b/Build/source/texk/texlive/linked_scripts/pdftex-quiet/pdftex-quiet @@ -1,36 +1,81 @@ #!/bin/bash # -# Author: Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> -# Licence: GNU GPLv3 -# Version: v1.0.0 +# pdftex-quiet +# Copyright (C) 2018 Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> # +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. -# Print help if required -if [[ "$@" =~ -help ]]; then - echo "Usage: pdftex-quiet [OPTION]... TEXNAME[.tex]" - echo - - # Print only arguments from the pdftex help - pdftex --help | grep --color=never -E '^[\[-]' -A500 - exit $? -fi +VERSION="v1.1.0" # Do not ignore failures within the pipe set -o pipefail -# FILENAME is always the last argument for pdftex +# Get the script name +BASENAME=`basename "$0"` + +# Remove the script's name '-quiet' suffix to get the underlying program to wrap +WRAPPED_PROGRAM=${BASENAME/%-quiet} + +# Assert the wrapped program is either pdflatex or pdftex +[[ "$WRAPPED_PROGRAM" =~ ^pdf(la)?tex$ ]] || { + echo "ERROR: Unsupported program to be wrapped!"; + echo " - only pdftex & pdflatex is allowed, but '$WRAPPED_PROGRAM' was provided."; + exit 101; +} + +# Assert the underlying program is installed +hash "$WRAPPED_PROGRAM" 2>/dev/null || { + echo "ERROR: You need to install $WRAPPED_PROGRAM first!"; + exit 102; +} + +# Print version if required +[[ "$@" =~ -v ]] && { + echo "pdfTeX-quiet $VERSION"; + "$WRAPPED_PROGRAM" --version; + exit $?; +} + +# Print help if required (let's print it even if only -h is specified +# although it's ambiguous because of -halt-on-error, but the regex should take care of that) +[[ "$@" =~ -h([^a]|$) ]] && { + echo -e "Usage: $BASENAME [OPTION]... TEXNAME[.tex]\n"; + + # Print only arguments from the pdftex|pdflatex help + "$WRAPPED_PROGRAM" --help | grep --color=never -E '^[\[-]' -A500; + exit $?; +} + +# FILENAME is always the last argument for pdftex|pdflatex # Create FILENAME variable only if there was provided some argument test $# -gt 0 && eval FILENAME=\${$#} # Test that the filename was provided -test -z "$FILENAME" && { echo "It's mandatory to provide the filename of tex source as first argument!" && exit 1; } +test -z "$FILENAME" && { + echo "It's mandatory to provide the filename of tex source as first argument!"; + exit 103; +} # Test the existence of the file provided -test -f "$FILENAME" || test -f "$FILENAME.tex" || { echo "Last argument must be a file! Provided file '$FILENAME' doesn't exist!" && exit 2; } +test -f "$FILENAME" || test -f "$FILENAME.tex" || { + echo "Last argument must be a file! Provided file '$FILENAME' doesn't exist!"; + exit 104; +} -# Run pdftex on the file. +# Run pdftex|pdflatex on the file. # Use -halt-on-error because grep basically disables the interactive mode. -# Using $@ we also allow to pass all other arguments to the pdftex. +# Using $@ we also allow to pass all other arguments to the pdftex|pdflatex. # Use grep to show only errors that occur with another 200 lines followed by the error. # Errors start with '!' at the line start. We match whole line to mark it in red bold color. @@ -43,7 +88,7 @@ test -f "$FILENAME" || test -f "$FILENAME.tex" || { echo "Last argument must be # characters without finishing newline character (which is usually printed after user's input). : | \ - pdftex --halt-on-error $@ | \ + "$WRAPPED_PROGRAM" --halt-on-error $@ | \ { ! grep --color=auto '^!.*' -A200; } EVERYTHING_SUCCEEDED=$? @@ -65,7 +110,7 @@ else [[ "$@" =~ -output-format(=|[ ]*)dvi($|[ ]*) ]] && EXTENSION=dvi || EXTENSION=pdf [[ "$@" =~ -output-directory(=|[ ]*)([^ $]*) ]] && OUTPUT_DIRECTORY="${BASH_REMATCH[2]}/" - # Replace whatever extension we provided to pdftex with either dvi or pdf (based on arguments provided) + # Replace whatever extension we provided to pdftex|pdflatex with either dvi or pdf (based on arguments provided) OUTPUT_FILENAME="${FILENAME/%.*/.${EXTENSION}}" echo "Output file: '${OUTPUT_DIRECTORY}${OUTPUT_FILENAME}'" diff --git a/Build/source/texk/texlive/linked_scripts/tlshell/tlshell.tcl b/Build/source/texk/texlive/linked_scripts/tlshell/tlshell.tcl index 23656017587..73b13f52cbd 100755 --- a/Build/source/texk/texlive/linked_scripts/tlshell/tlshell.tcl +++ b/Build/source/texk/texlive/linked_scripts/tlshell/tlshell.tcl @@ -33,7 +33,7 @@ if {$::tcl_platform(platform) ne "windows"} { # declarations and utilities shared with install-tl-gui.tcl set ::instroot [exec kpsewhich -var-value=TEXMFROOT] -source [file join $::instroot "tlpkg" "TeXLive" "tltcl.tcl"] +source [file join $::instroot "tlpkg" "tltcl" "tltcl.tcl"] # searchpath and locale: # windows: most scripts run via [w]runscript, which adjusts the searchpath diff --git a/Master/texmf-dist/doc/support/pdftex-quiet/LICENCE b/Master/texmf-dist/doc/support/pdftex-quiet/LICENCE index e693f1865a8..a59e9c6fa83 100644 --- a/Master/texmf-dist/doc/support/pdftex-quiet/LICENCE +++ b/Master/texmf-dist/doc/support/pdftex-quiet/LICENCE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. pdftex-quiet - Copyright (C) 2018 productivity + Copyright (C) 2018 Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - pdftex-quiet Copyright (C) 2018 productivity + pdftex-quiet Copyright (C) 2018 Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/Master/texmf-dist/doc/support/pdftex-quiet/README.md b/Master/texmf-dist/doc/support/pdftex-quiet/README.md index 49e0a2e5f4c..332932811e4 100644 --- a/Master/texmf-dist/doc/support/pdftex-quiet/README.md +++ b/Master/texmf-dist/doc/support/pdftex-quiet/README.md @@ -4,30 +4,39 @@ This is a tool in BASH serving to reduce the output of `pdftex` command and see Originally, I've started this as [the TeX StackExchange answer](https://tex.stackexchange.com/a/459470/134632). -Now, it's being proposed as a CTAN package called also `pdftex-quiet`. +Currently, [you can find this repository in a Comprehensive TeX Archive Network (CTAN)](https://ctan.org/pkg/pdftex-quiet) under `/support/pdftex-quiet`. -## Installation +## Quickinstall the latest version + +```bash +curl -s https://gitlab.com/jirislav/pdftex-quiet/raw/latest/pdftex-quiet | \ + sudo tee /usr/local/bin/pdftex-quiet >/dev/null \ + && sudo chmod +x /usr/local/bin/pdftex-quiet \ + && sudo ln -sf /usr/local/bin/pdf{,la}tex-quiet +``` + +## Installation from git Download this repository: ```bash -git clone https://gitlab.jkozlovsky.cz/productivity/pdftex-quiet.git +git clone https://gitlab.com/jirislav/pdftex-quiet.git cd pdftex-quiet ``` Simply copy the bash script to your `$PATH`: ```bash -cp bin/pdftex-quiet /usr/local/bin/ +cp pdftex-quiet /usr/local/bin/ chmod +x /usr/local/bin/pdftex-quiet # Make sure we support also pdflatex-quiet command (pdflatex is also a symlink to pdftex command) -ln -sf /usr/local/bin/pdftex-quiet /usr/local/bin/pdflatex-quiet +ln -sf /usr/local/bin/pdf{,la}tex-quiet ``` ## Usage -Usage is the same as with `pdftex` (it supports all the arguments except [COMMANDS], **but the filename is mandatory!**). +Usage is the same as with `pdftex` and `pdflatex` (it supports all the arguments except the `[COMMANDS]`, **but the filename is mandatory!**). ```bash # Keep in mind that the last argument should always be the filename to compile @@ -39,6 +48,9 @@ pdftex-quiet --help # But most probably you simply want to run the pdftex without modifications: pdftex-quiet my_tex_source.tex + +# Also you might want to use LaTeX instead: +pdflatex-quiet my_tex_source.tex ``` ## Licence diff --git a/Master/texmf-dist/doc/support/pdftex-quiet/VERSION b/Master/texmf-dist/doc/support/pdftex-quiet/VERSION index 0ec25f7505c..795460fcec8 100644 --- a/Master/texmf-dist/doc/support/pdftex-quiet/VERSION +++ b/Master/texmf-dist/doc/support/pdftex-quiet/VERSION @@ -1 +1 @@ -v1.0.0 +v1.1.0 diff --git a/Master/texmf-dist/scripts/pdftex-quiet/pdftex-quiet b/Master/texmf-dist/scripts/pdftex-quiet/pdftex-quiet index 6a12b2eeb7d..7bf4599c71b 100755 --- a/Master/texmf-dist/scripts/pdftex-quiet/pdftex-quiet +++ b/Master/texmf-dist/scripts/pdftex-quiet/pdftex-quiet @@ -1,36 +1,81 @@ #!/bin/bash # -# Author: Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> -# Licence: GNU GPLv3 -# Version: v1.0.0 +# pdftex-quiet +# Copyright (C) 2018 Jiří Kozlovský <pdftex-quiet@jkozlovsky.cz> # +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. -# Print help if required -if [[ "$@" =~ -help ]]; then - echo "Usage: pdftex-quiet [OPTION]... TEXNAME[.tex]" - echo - - # Print only arguments from the pdftex help - pdftex --help | grep --color=never -E '^[\[-]' -A500 - exit $? -fi +VERSION="v1.1.0" # Do not ignore failures within the pipe set -o pipefail -# FILENAME is always the last argument for pdftex +# Get the script name +BASENAME=`basename "$0"` + +# Remove the script's name '-quiet' suffix to get the underlying program to wrap +WRAPPED_PROGRAM=${BASENAME/%-quiet} + +# Assert the wrapped program is either pdflatex or pdftex +[[ "$WRAPPED_PROGRAM" =~ ^pdf(la)?tex$ ]] || { + echo "ERROR: Unsupported program to be wrapped!"; + echo " - only pdftex & pdflatex is allowed, but '$WRAPPED_PROGRAM' was provided."; + exit 101; +} + +# Assert the underlying program is installed +hash "$WRAPPED_PROGRAM" 2>/dev/null || { + echo "ERROR: You need to install $WRAPPED_PROGRAM first!"; + exit 102; +} + +# Print version if required +[[ "$@" =~ -v ]] && { + echo "pdfTeX-quiet $VERSION"; + "$WRAPPED_PROGRAM" --version; + exit $?; +} + +# Print help if required (let's print it even if only -h is specified +# although it's ambiguous because of -halt-on-error, but the regex should take care of that) +[[ "$@" =~ -h([^a]|$) ]] && { + echo -e "Usage: $BASENAME [OPTION]... TEXNAME[.tex]\n"; + + # Print only arguments from the pdftex|pdflatex help + "$WRAPPED_PROGRAM" --help | grep --color=never -E '^[\[-]' -A500; + exit $?; +} + +# FILENAME is always the last argument for pdftex|pdflatex # Create FILENAME variable only if there was provided some argument test $# -gt 0 && eval FILENAME=\${$#} # Test that the filename was provided -test -z "$FILENAME" && { echo "It's mandatory to provide the filename of tex source as first argument!" && exit 1; } +test -z "$FILENAME" && { + echo "It's mandatory to provide the filename of tex source as first argument!"; + exit 103; +} # Test the existence of the file provided -test -f "$FILENAME" || test -f "$FILENAME.tex" || { echo "Last argument must be a file! Provided file '$FILENAME' doesn't exist!" && exit 2; } +test -f "$FILENAME" || test -f "$FILENAME.tex" || { + echo "Last argument must be a file! Provided file '$FILENAME' doesn't exist!"; + exit 104; +} -# Run pdftex on the file. +# Run pdftex|pdflatex on the file. # Use -halt-on-error because grep basically disables the interactive mode. -# Using $@ we also allow to pass all other arguments to the pdftex. +# Using $@ we also allow to pass all other arguments to the pdftex|pdflatex. # Use grep to show only errors that occur with another 200 lines followed by the error. # Errors start with '!' at the line start. We match whole line to mark it in red bold color. @@ -43,7 +88,7 @@ test -f "$FILENAME" || test -f "$FILENAME.tex" || { echo "Last argument must be # characters without finishing newline character (which is usually printed after user's input). : | \ - pdftex --halt-on-error $@ | \ + "$WRAPPED_PROGRAM" --halt-on-error $@ | \ { ! grep --color=auto '^!.*' -A200; } EVERYTHING_SUCCEEDED=$? @@ -65,7 +110,7 @@ else [[ "$@" =~ -output-format(=|[ ]*)dvi($|[ ]*) ]] && EXTENSION=dvi || EXTENSION=pdf [[ "$@" =~ -output-directory(=|[ ]*)([^ $]*) ]] && OUTPUT_DIRECTORY="${BASH_REMATCH[2]}/" - # Replace whatever extension we provided to pdftex with either dvi or pdf (based on arguments provided) + # Replace whatever extension we provided to pdftex|pdflatex with either dvi or pdf (based on arguments provided) OUTPUT_FILENAME="${FILENAME/%.*/.${EXTENSION}}" echo "Output file: '${OUTPUT_DIRECTORY}${OUTPUT_FILENAME}'" |