summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-10-09 20:17:02 +0000
committerKarl Berry <karl@freefriends.org>2022-10-09 20:17:02 +0000
commit8a6d48a527b72509e633ae27ce04f49a09abd7fa (patch)
treef0387c918616a771255b8d73971e7564c7b78f20
parent397183e0ea8dbd39bacd6c3e44225ef8755e72af (diff)
iexec (9oct22)
git-svn-id: svn://tug.org/texlive/trunk@64663 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/iexec/DEPENDS.txt1
-rw-r--r--Master/texmf-dist/doc/latex/iexec/iexec.pdfbin284051 -> 294434 bytes
-rw-r--r--Master/texmf-dist/source/latex/iexec/iexec.dtx96
-rw-r--r--Master/texmf-dist/source/latex/iexec/iexec.ins8
-rw-r--r--Master/texmf-dist/tex/latex/iexec/iexec.sty36
5 files changed, 120 insertions, 21 deletions
diff --git a/Master/texmf-dist/doc/latex/iexec/DEPENDS.txt b/Master/texmf-dist/doc/latex/iexec/DEPENDS.txt
index 5fa4f92b5c9..3e3774f0e2e 100644
--- a/Master/texmf-dist/doc/latex/iexec/DEPENDS.txt
+++ b/Master/texmf-dist/doc/latex/iexec/DEPENDS.txt
@@ -1,3 +1,4 @@
hard shellesc
hard pgfkeys
hard xkeyval
+hard expl3
diff --git a/Master/texmf-dist/doc/latex/iexec/iexec.pdf b/Master/texmf-dist/doc/latex/iexec/iexec.pdf
index 74233b48102..6030b3fa7ae 100644
--- a/Master/texmf-dist/doc/latex/iexec/iexec.pdf
+++ b/Master/texmf-dist/doc/latex/iexec/iexec.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/iexec/iexec.dtx b/Master/texmf-dist/source/latex/iexec/iexec.dtx
index fb38432b0ea..2478ac224ae 100644
--- a/Master/texmf-dist/source/latex/iexec/iexec.dtx
+++ b/Master/texmf-dist/source/latex/iexec/iexec.dtx
@@ -50,17 +50,14 @@
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{iexec}
%<*package>
-[01.10.2022 0.6.1 Inputable Shell Executions]
+[09.10.20220 0.7.0 Inputable Shell Executions]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[tt=false, type1=true]{libertine}
+\usepackage{microtype}
\usepackage{iexec}
\usepackage{href-ul}
-\raggedbottom
-\setlength{\parindent}{0pt}
-\setlength{\columnsep}{32pt}
-\setlength{\parskip}{6pt}
\PageIndex
\EnableCrossrefs
\CodelineIndex
@@ -105,7 +102,7 @@ Today is
%
% \columnbreak
%
-% Today is \iexec{date +\%e-\%b-\%Y}
+% Today is \iexec[log]{date +\%e-\%b-\%Y}
% \end{multicols}
% \begin{macro}{\iexec}
@@ -184,6 +181,43 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
%\fi
% \end{macro}
+% \begin{macro}{append}
+% The stdout produced will be appended to the file specified:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage[trace]{iexec}
+\begin{document}
+\iexec[append,stdout=foo.txt,quiet]{echo 'Hello, '}
+\iexec[append,stdout=foo.txt,quiet]{echo 'Jeffrey!'}
+\input{foo.txt}
+\end{document}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+% \end{macro}
+
+% \begin{macro}{log}
+% The stdout produced will be printed in \TeX{} log:
+%\iffalse
+%<*verb>
+%\fi
+\begin{verbatim}
+\documentclass{article}
+\usepackage{iexec}
+\begin{document}
+\iexec[log]{echo 'Hello, \\LaTeX!'}
+\input{foo.txt}
+\end{document}
+\end{verbatim}
+%\iffalse
+%</verb>
+%\fi
+% \end{macro}
+
% \StopEventually{}
% \section{Implementation}
@@ -193,9 +227,15 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \changes{v0.4.1}{2021/08/08}{Options trace, stdout, and quiet added}
% \changes{v0.5.0}{2022/01/08}{Major bug fixes}
-% \iffalse
+% First, we include a few packages:
+% \begin{macrocode}
\RequirePackage{shellesc}
\RequirePackage{pgfkeys}
+\RequirePackage{expl3}
+% \end{macrocode}
+
+% Then, we parse package options:
+% \begin{macrocode}
\RequirePackage{xkeyval}
\makeatletter\newif\ifiexec@trace
\DeclareOptionX{trace}{\iexec@tracetrue}
@@ -206,12 +246,34 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
stdout/.estore in = \iexec@stdout,
stdout/.default = iexec.tmp,
trace/.estore in = \iexec@traceit,
+ append/.estore in = \iexec@append,
+ log/.estore in = \iexec@log,
quiet/.estore in = \iexec@quiet,
stdout
}\makeatother
-% \fi
+% \end{macrocode}
+
+% \begin{macro}{\iexec@typeout}
+% Then, we define an internal command |\iexec@typeout| for printing the content of a file,
+% as suggested \href{https://tex.stackexchange.com/questions/660808}{here}:
+% \begin{macrocode}
+\makeatletter\ExplSyntaxOn
+\NewDocumentCommand{\iexec@typeout}{m}{
+ \iexec_typeout_file:n { #1 }}
+\ior_new:N \g_iexec_typeout_ior
+\cs_new_protected:Nn \iexec_typeout_file:n
+{
+ \ior_open:Nn \g_iexec_typeout_ior { #1 }
+ \ior_str_map_inline:Nn \g_iexec_typeout_ior
+ {\iow_term:n { ##1 }}
+ \ior_close:N \g_iexec_typeout_ior
+}
+\ExplSyntaxOff\makeatother
+% \end{macrocode}
+% \end{macro}
% \begin{macro}{\iexec}
+% Then, we define |\iexec| command.
% It is implemented with the help of |\ShellEscape| from |shellesc| package:
% \begin{macrocode}
\makeatletter\newcommand\iexec[2][]{%
@@ -222,7 +284,7 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% it nothing will work; so, it's better to throw an error earlier than later:
% \begin{macrocode}
\ifdefined\pdfshellescape\ifnum\pdfshellescape=1\else%
- \PackageError{iexec}{You must run latex with
+ \PackageError{iexec}{You must run TeX processor with
--shell-escape option}{}%
\fi\fi%
\begingroup%
@@ -238,19 +300,29 @@ This file won't be deleted: \iexec[stdout=me.txt]{whoami}.
% \end{macrocode}
% Then, we execute it:
% \begin{macrocode}
- \ShellEscape{#2 > \iexec@stdout}%
+ \ShellEscape{#2 \ifdefined\iexec@append>\fi> \iexec@stdout}%
% \end{macrocode}
% Then, a message is printed to TeX log:
% \begin{macrocode}
\message{^^Jiexec: [#2 > \iexec@stdout]^^J}%
\endgroup%
% \end{macrocode}
+% Then, if required, the content of the stdout file will be printed to the log:
+% \begin{macrocode}
+ \ifdefined\iexec@log
+ \message{^^Jiexec: this is the content of \iexec@stdout:^^J}%
+ \iexec@typeout{\iexec@stdout}
+ \message{^^J<EOF>^^J}%
+ \fi%
+% \end{macrocode}
% Then, include the produced output into the current document:
% \begin{macrocode}
\ifdefined\iexec@quiet
- \message{^^Jiexec: Due to 'quiet' we didn't read
- the content of '\iexec@stdout'^^J}%
+ \message{^^Jiexec: Due to 'quiet' option we didn't read
+ the content of '\iexec@stdout' (\pdffilesize{} bytes)^^J}%
\else%
+ \message{^^Jiexec: We include the content of
+ '\iexec@stdout' (\pdffilesize{} bytes)...^^J}%
\input{\iexec@stdout}%
\message{^^Jiexec: The content of '\iexec@stdout'
was included into the document^^J}%
diff --git a/Master/texmf-dist/source/latex/iexec/iexec.ins b/Master/texmf-dist/source/latex/iexec/iexec.ins
index 36172278a67..8d2fd38a421 100644
--- a/Master/texmf-dist/source/latex/iexec/iexec.ins
+++ b/Master/texmf-dist/source/latex/iexec/iexec.ins
@@ -48,8 +48,8 @@ SOFTWARE.
\endpreamble
\generate{\file{iexec.sty}{\from{iexec.dtx}{package}}}
\obeyspaces
-\Msg{*** To finish the installation you have to move the ".sty"}
-\Msg{*** file into a directory searched by TeX. To produce the}
-\Msg{*** documentation run the file ".dtx" through LaTeX. If any}
-\Msg{*** questions, submit a new GitHub issue.}
+\Msg{To finish the installation you have to move the ".sty"}
+\Msg{file into a directory searched by TeX. To produce the}
+\Msg{documentation run the file ".dtx" through LaTeX. If any}
+\Msg{questions, submit a new GitHub issue.}
\endbatchfile
diff --git a/Master/texmf-dist/tex/latex/iexec/iexec.sty b/Master/texmf-dist/tex/latex/iexec/iexec.sty
index 1476f02bdc5..5477d07a062 100644
--- a/Master/texmf-dist/tex/latex/iexec/iexec.sty
+++ b/Master/texmf-dist/tex/latex/iexec/iexec.sty
@@ -31,7 +31,9 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{iexec}
-[01.10.2022 0.6.1 Inputable Shell Executions]
+[09.10.20220 0.7.0 Inputable Shell Executions]
+
+
@@ -45,6 +47,8 @@
\RequirePackage{shellesc}
\RequirePackage{pgfkeys}
+\RequirePackage{expl3}
+
\RequirePackage{xkeyval}
\makeatletter\newif\ifiexec@trace
\DeclareOptionX{trace}{\iexec@tracetrue}
@@ -55,15 +59,30 @@
stdout/.estore in = \iexec@stdout,
stdout/.default = iexec.tmp,
trace/.estore in = \iexec@traceit,
+ append/.estore in = \iexec@append,
+ log/.estore in = \iexec@log,
quiet/.estore in = \iexec@quiet,
stdout
}\makeatother
+\makeatletter\ExplSyntaxOn
+\NewDocumentCommand{\iexec@typeout}{m}{
+ \iexec_typeout_file:n { #1 }}
+\ior_new:N \g_iexec_typeout_ior
+\cs_new_protected:Nn \iexec_typeout_file:n
+{
+ \ior_open:Nn \g_iexec_typeout_ior { #1 }
+ \ior_str_map_inline:Nn \g_iexec_typeout_ior
+ {\iow_term:n { ##1 }}
+ \ior_close:N \g_iexec_typeout_ior
+}
+\ExplSyntaxOff\makeatother
+
\makeatletter\newcommand\iexec[2][]{%
\begingroup
\pgfqkeys{/iexec}{#1}%
\ifdefined\pdfshellescape\ifnum\pdfshellescape=1\else%
- \PackageError{iexec}{You must run latex with
+ \PackageError{iexec}{You must run TeX processor with
--shell-escape option}{}%
\fi\fi%
\begingroup%
@@ -71,13 +90,20 @@
\let\\\@backslashchar%
\let\{\@charlb%
\let\}\@charrb%
- \ShellEscape{#2 > \iexec@stdout}%
+ \ShellEscape{#2 \ifdefined\iexec@append>\fi> \iexec@stdout}%
\message{^^Jiexec: [#2 > \iexec@stdout]^^J}%
\endgroup%
+ \ifdefined\iexec@log
+ \message{^^Jiexec: this is the content of \iexec@stdout:^^J}%
+ \iexec@typeout{\iexec@stdout}
+ \message{^^J<EOF>^^J}%
+ \fi%
\ifdefined\iexec@quiet
- \message{^^Jiexec: Due to 'quiet' we didn't read
- the content of '\iexec@stdout'^^J}%
+ \message{^^Jiexec: Due to 'quiet' option we didn't read
+ the content of '\iexec@stdout' (\pdffilesize{} bytes)^^J}%
\else%
+ \message{^^Jiexec: We include the content of
+ '\iexec@stdout' (\pdffilesize{} bytes)...^^J}%
\input{\iexec@stdout}%
\message{^^Jiexec: The content of '\iexec@stdout'
was included into the document^^J}%