[latex3-commits] [git/LaTeX3-latex3-l3build] curl-file: add uploadconfig.announcement_file and uploadconfig.note_file these take a string with (optional) filenames if uploadconfig.note_file is nil or the file is not readable uploadconfig.note remains as nil otherwise it is set to the contents of the specified file. (2cf6185)

David Carlisle d.p.carlisle at gmail.com
Sun Feb 3 21:59:14 CET 2019


Repository : https://github.com/latex3/l3build
On branch  : curl-file
Link       : https://github.com/latex3/l3build/commit/2cf61855cae9ce79b110be19bc48d995180e138d

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

commit 2cf61855cae9ce79b110be19bc48d995180e138d
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Feb 3 20:59:14 2019 +0000

    add uploadconfig.announcement_file and uploadconfig.note_file
    these take a string with (optional) filenames if uploadconfig.note_file
    is nil or the file is not readable uploadconfig.note remains as nil
    otherwise it is set to the contents of the specified file.
    
    Avoids need to use commadnline arguments to specify files to use.


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

2cf61855cae9ce79b110be19bc48d995180e138d
 l3build-upload.lua |   21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/l3build-upload.lua b/l3build-upload.lua
index f95aac4..8e1fff5 100644
--- a/l3build-upload.lua
+++ b/l3build-upload.lua
@@ -94,9 +94,12 @@ function upload(tagnames)
     uploadconfig.announcement = assert(f:read('*a'))
     close(f)
   end
-  uploadconfig.announcement = options["message"] or uploadconfig.announcement
+  uploadconfig.announcement = options["message"] or uploadconfig.announcement or file_contents(uploadconfig.announcement_file)
   uploadconfig.email = options["email"] or uploadconfig.email
 
+
+  uploadconfig.note =   uploadconfig.note  or file_contents(uploadconfig.note_file)
+
   local tagnames = tagnames or { }
   uploadconfig.version = tagnames[1] or uploadconfig.version
 
@@ -330,3 +333,19 @@ function input_single_line_field(name)
   return field
 end
 
+
+-- if filename is non nil and file readable return contents otherwise nil
+function file_contents (filename)
+  if filename ~= nil then
+    local f= open(filename,"r")
+    if f==nil then
+      return nil
+    else 
+      local s = f:read("*all")
+      close(f)
+      return s
+    end
+  else
+    return nil
+  end
+end





More information about the latex3-commits mailing list