texlive[68882] trunk: runtexshebang (17nov23)

commits+karl at tug.org commits+karl at tug.org
Fri Nov 17 23:03:07 CET 2023


Revision: 68882
          https://tug.org/svn/texlive?view=revision&revision=68882
Author:   karl
Date:     2023-11-17 23:03:07 +0100 (Fri, 17 Nov 2023)
Log Message:
-----------
runtexshebang (17nov23)

Modified Paths:
--------------
    trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua
    trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
    trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua

Modified: trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua	2023-11-17 22:02:57 UTC (rev 68881)
+++ trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua	2023-11-17 22:03:07 UTC (rev 68882)
@@ -23,11 +23,12 @@
 -- THE SOFTWARE.
 
 NAME = "runtexshebang"
-VERSION = "20230913 v0.4"
+VERSION = "20231117 v0.5"
 USAGE = [[
 Usage:	runtexshebang [input.tex]
 
 Options:
+	--dry-run	print the TeX-style shebang line of [input.tex]
 	-h, --help	print help
 	-v, --version	print version
 
@@ -53,6 +54,7 @@
 end
 
 --
+is_dryrun = false
 texfilename = ""
 narg = 1
 repeat
@@ -66,6 +68,8 @@
   elseif this_arg == "-v" or this_arg == "-version" then
      whoami()
      os.exit(0)
+  elseif this_arg == "-dry-run" then
+     is_dryrun = true
   else
      texfilename = this_arg
   end --if this_arg == ...
@@ -75,6 +79,11 @@
 -- main process
 whoami()
 
+if ( texfilename == "" ) then
+   print("No filename argument given, exiting.\n")
+   os.exit(1)
+end
+
 line_ctr = 0
 for line in io.lines(texfilename) do
    line_ctr = line_ctr + 1
@@ -82,6 +91,12 @@
 
    if string.match(line, "^%%#!") then
       tex_cmd, err=string.gsub(line, "%%#!", "")
+
+      if is_dryrun then
+         print(tex_cmd .. "\n")
+         os.exit(0)
+      end
+
       tex_return = os.execute(tex_cmd)
 
       -- if os.execute(texcmd) returns -1 on Windows, then

Modified: trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexshebang/README.md	2023-11-17 22:02:57 UTC (rev 68881)
+++ trunk/Master/texmf-dist/doc/support/runtexshebang/README.md	2023-11-17 22:03:07 UTC (rev 68882)
@@ -131,7 +131,7 @@
 ### How about general configuration information for the activated TeX Live version and its configuration in my editor?
 
 ``` latex
-%#! tlmgr --conf
+%#! tlmgr conf
 ```
 
 ### Otherwise

Modified: trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua	2023-11-17 22:02:57 UTC (rev 68881)
+++ trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua	2023-11-17 22:03:07 UTC (rev 68882)
@@ -23,11 +23,12 @@
 -- THE SOFTWARE.
 
 NAME = "runtexshebang"
-VERSION = "20230913 v0.4"
+VERSION = "20231117 v0.5"
 USAGE = [[
 Usage:	runtexshebang [input.tex]
 
 Options:
+	--dry-run	print the TeX-style shebang line of [input.tex]
 	-h, --help	print help
 	-v, --version	print version
 
@@ -53,6 +54,7 @@
 end
 
 --
+is_dryrun = false
 texfilename = ""
 narg = 1
 repeat
@@ -66,6 +68,8 @@
   elseif this_arg == "-v" or this_arg == "-version" then
      whoami()
      os.exit(0)
+  elseif this_arg == "-dry-run" then
+     is_dryrun = true
   else
      texfilename = this_arg
   end --if this_arg == ...
@@ -75,6 +79,11 @@
 -- main process
 whoami()
 
+if ( texfilename == "" ) then
+   print("No filename argument given, exiting.\n")
+   os.exit(1)
+end
+
 line_ctr = 0
 for line in io.lines(texfilename) do
    line_ctr = line_ctr + 1
@@ -82,6 +91,12 @@
 
    if string.match(line, "^%%#!") then
       tex_cmd, err=string.gsub(line, "%%#!", "")
+
+      if is_dryrun then
+         print(tex_cmd .. "\n")
+         os.exit(0)
+      end
+
       tex_return = os.execute(tex_cmd)
 
       -- if os.execute(texcmd) returns -1 on Windows, then



More information about the tex-live-commits mailing list.