summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/latexgit/latexgit.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/latexgit/latexgit.dtx')
-rw-r--r--macros/latex/contrib/latexgit/latexgit.dtx23
1 files changed, 19 insertions, 4 deletions
diff --git a/macros/latex/contrib/latexgit/latexgit.dtx b/macros/latex/contrib/latexgit/latexgit.dtx
index 100d1d16a8..2d8435fc7b 100644
--- a/macros/latex/contrib/latexgit/latexgit.dtx
+++ b/macros/latex/contrib/latexgit/latexgit.dtx
@@ -16,7 +16,7 @@ latexgit
Author: Camil Staps <info@camilstaps.nl>
\endpreamble
\postamble
-Copyright (c) 2016 Camil Staps <info@camilstaps.nl>
+Copyright (c) 2016-2020 Camil Staps <info@camilstaps.nl>
Licensed under GPL v3.
\endpostamble
\usedir{tex/latex/latexgit}
@@ -226,11 +226,15 @@ Licensed under GPL v3.
%
%\DescribeMacro{\gitcommitdate}
% This macro displays the \git{} commit date.
-% The following example shows a usage example and shows the results of the
-% options
+% The following example shows the effect of the options
% \gitopt{formatDate}, \gitopt{formatTime} and \gitopt{showTimeZone}.
% \LTXinputExample[pos=b,numbers=none]{exmp/gitcommitdate.tex}
%
+%\DescribeMacro{\gitcommand}
+% This macro executes an arbitrary \git{} command and directly typesets the
+% result. It only accepts the option \gitopt{directory}.
+% \LTXinputExample[pos=b,numbers=none]{exmp/gitcommand.tex}
+%
%\section{Implementation}
%\label{sec:implementation}
%Define the package and load required packages.
@@ -240,7 +244,7 @@ Licensed under GPL v3.
% \end{comment}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{latexgit}[2020/03/18]
+\ProvidesPackage{latexgit}[2020/04/20]
\RequirePackage{pgfkeys}
\RequirePackage{datetime}
@@ -319,6 +323,17 @@ Licensed under GPL v3.
% \end{macrocode}
%\end{macro}
%
+%\begin{macro}{\gitcommand}
+% A wrapper around \cs{git@command} and \cs{git@result}, to directly typeset the
+% result of arbitrary commands.
+% \begin{macrocode}
+\newcommand{\gitcommand}[2][]{%
+ \pgfkeys{/git,default,#1}%
+ \git@command{git #2}%
+ \git@result}
+% \end{macrocode}
+%\end{macro}
+%
%In what follows, \verb$%$ may be used in calls to \git{}. Therefore we use
%\verb$&$ as comment character.
% \begin{macrocode}