[latex3-commits] [git/LaTeX3-latex3-l3build] master: allow no tag to be given on the command line (6834c33)

Will Robertson wspr81 at gmail.com
Mon Jan 7 08:19:39 CET 2019


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/6834c33cd348cf8b459eaedd8297ff6b32d121ec

>---------------------------------------------------------------

commit 6834c33cd348cf8b459eaedd8297ff6b32d121ec
Author: Will Robertson <wspr81 at gmail.com>
Date:   Mon Jan 7 15:18:47 2019 +0800

    allow no tag to be given on the command line
    
    this is to permit setting the tag via the build.lua script itself
    
    (I think we're all okay with this but happy to discuss further.)


>---------------------------------------------------------------

6834c33cd348cf8b459eaedd8297ff6b32d121ec
 l3build-stdmain.lua |    5 ++---
 l3build-tagging.lua |    5 ++++-
 l3build.dtx         |   17 +++++++++--------
 3 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/l3build-stdmain.lua b/l3build-stdmain.lua
index f2d8797..668b2d0 100644
--- a/l3build-stdmain.lua
+++ b/l3build-stdmain.lua
@@ -120,9 +120,8 @@ target_list =
         desc = "Updates release tags in files",
         func = tag,
         pre  = function(names)
-           if not names or #names ~=1 then
-             print("Tag name required")
-             help()
+           if names and #names > 1 then
+             print("Too many tags specified; exactly one required")
              exit(1)
            end
            return 0
diff --git a/l3build-tagging.lua b/l3build-tagging.lua
index 6ad11e6..2c0c164 100644
--- a/l3build-tagging.lua
+++ b/l3build-tagging.lua
@@ -63,7 +63,10 @@ end
 
 function tag(tagnames)
   local tagdate = options["date"] or os_date("%Y-%m-%d")
-  local tagname = tagnames[1] or tagdate
+  local tagname = nil
+  if tagnames then
+    tagname = tagnames[1]
+  end
   local dirs = remove_duplicates({currentdir, sourcefiledir, docfiledir})
   local errorlevel = 0
   for _,dir in pairs(dirs) do
diff --git a/l3build.dtx b/l3build.dtx
index 5b20477..93463a3 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -536,14 +536,15 @@
 %
 % \begin{buildcmd}{tag}
 % Modifies the contents of files specified by |tagfiles| using a search pattern
-% to automatically update the `release tag' (or package version) and date. The tag is given as a
-% command line option, whilst the optional date should be passed using
-% |--date| (|-d|); if not given, the date will default to the current date in
-% ISO format (YYYY-MM-DD). The standard set up has no search
-% pattern defined for this target and so no action will be taken \emph{unless}
-% tag substitution is set up.
-%
-% See Section~\ref{sec:tagging} for full details on this feature.
+% to automatically update the `release tag' (or package version) and date.
+% The tag is given as the command line option and the date using
+% |--date| (|-d|). If not given, the date will default to the current date in
+% ISO format (YYYY-MM-DD). If no option is given (i.e., no tag specified) the tag
+% is passed through as |nil| to allow setting the tag programmatically.
+%
+% The standard setup has no search pattern defined for this target and so no action
+% will be taken \emph{unless} tag substitution is set up by defining the Lua function
+% |update_tag()|. See Section~\ref{sec:tagging} for full details on this feature.
 % \end{buildcmd}
 %
 % \begin{buildcmd}{unpack}





More information about the latex3-commits mailing list