summaryrefslogtreecommitdiff
path: root/support/runtexshebang
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-18 03:01:07 +0000
committerNorbert Preining <norbert@preining.info>2023-11-18 03:01:07 +0000
commitbcd1a2a7dfe36b38f10a8fa23b4b6f0c325ca899 (patch)
tree2df3f6c998a7a44c9c5365c0ab78e7c152bc0082 /support/runtexshebang
parentd91bb5cad66508ec34d77ea60c0a02c79308edef (diff)
CTAN sync 202311180301
Diffstat (limited to 'support/runtexshebang')
-rw-r--r--support/runtexshebang/README.md2
-rwxr-xr-xsupport/runtexshebang/runtexshebang.lua17
2 files changed, 17 insertions, 2 deletions
diff --git a/support/runtexshebang/README.md b/support/runtexshebang/README.md
index 7c3f233b2d..7794c318e2 100644
--- a/support/runtexshebang/README.md
+++ b/support/runtexshebang/README.md
@@ -131,7 +131,7 @@ There the “Engine” settings for the command lines "TeX+dvipdfmx / TeX+dvips+
### How about general configuration information for the activated TeX Live version and its configuration in my editor?
``` latex
-%#! tlmgr --conf
+%#! tlmgr conf
```
### Otherwise
diff --git a/support/runtexshebang/runtexshebang.lua b/support/runtexshebang/runtexshebang.lua
index 670bdc2b33..f0c817165c 100755
--- a/support/runtexshebang/runtexshebang.lua
+++ b/support/runtexshebang/runtexshebang.lua
@@ -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 @@ if #arg == 0 then
end
--
+is_dryrun = false
texfilename = ""
narg = 1
repeat
@@ -66,6 +68,8 @@ repeat
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 @@ until narg > #arg
-- 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 @@ for line in io.lines(texfilename) do
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