texlive[68269] trunk: runtexshebang (13sep23)
commits+karl at tug.org
commits+karl at tug.org
Wed Sep 13 22:38:34 CEST 2023
Revision: 68269
http://tug.org/svn/texlive?view=revision&revision=68269
Author: karl
Date: 2023-09-13 22:38:34 +0200 (Wed, 13 Sep 2023)
Log Message:
-----------
runtexshebang (13sep23)
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-09-13 20:38:22 UTC (rev 68268)
+++ trunk/Build/source/texk/texlive/linked_scripts/runtexshebang/runtexshebang.lua 2023-09-13 20:38:34 UTC (rev 68269)
@@ -22,15 +22,61 @@
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-if not ( #arg == 1 ) then
- print("runtexshebang 20230909 v0.3")
- print("")
- print("Usage: runtexshebang [input.tex]")
- os.exit(0)
+NAME = "runtexshebang"
+VERSION = "20230913 v0.4"
+USAGE = [[
+Usage: runtexshebang [input.tex]
+
+Options:
+ -h, --help print help
+ -v, --version print version
+
+See also:
+The command
+ texdoc runtexshebang
+should give you access to the README.
+]]
+
+function whoami()
+ print(NAME .. " " .. VERSION)
end
-local line_ctr = 0
-for line in io.lines(arg[1]) do
+function help()
+ whoami()
+ print()
+ print(USAGE)
+end
+
+if #arg == 0 then
+ help()
+ os.exit(0)
+end
+
+--
+texfilename = ""
+narg = 1
+repeat
+ this_arg = arg[narg]
+ -- replace double dash by single dash at the beginning
+ this_arg = string.gsub(this_arg, "^%-%-", "-")
+
+ if this_arg == "-h" or this_arg == "-help" then
+ help()
+ os.exit(0)
+ elseif this_arg == "-v" or this_arg == "-version" then
+ whoami()
+ os.exit(0)
+ else
+ texfilename = this_arg
+ end --if this_arg == ...
+ narg = narg+1
+until narg > #arg
+
+-- main process
+whoami()
+
+line_ctr = 0
+for line in io.lines(texfilename) do
line_ctr = line_ctr + 1
if line_ctr > 20 then break end
Modified: trunk/Master/texmf-dist/doc/support/runtexshebang/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/support/runtexshebang/README.md 2023-09-13 20:38:22 UTC (rev 68268)
+++ trunk/Master/texmf-dist/doc/support/runtexshebang/README.md 2023-09-13 20:38:34 UTC (rev 68269)
@@ -158,10 +158,17 @@
## References
+### Commentary
+
* [TeXworks、TeXShop、VSCodeでTeX-style shebangしてみた - Qiita](https://qiita.com/munepi/items/a30c68133cfffbf4d189) (in Japanese)
+### Tools supporting `%#!`
+* [YaTeX](https://www.yatex.org/): Yet Another TeX mode for Emacs
+* [llmk](https://github.com/wtsnjp/llmk): Light LaTeX Make
+
+
Enjoy Happy TeXing!
Modified: trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua
===================================================================
--- trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua 2023-09-13 20:38:22 UTC (rev 68268)
+++ trunk/Master/texmf-dist/scripts/runtexshebang/runtexshebang.lua 2023-09-13 20:38:34 UTC (rev 68269)
@@ -22,15 +22,61 @@
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-if not ( #arg == 1 ) then
- print("runtexshebang 20230909 v0.3")
- print("")
- print("Usage: runtexshebang [input.tex]")
- os.exit(0)
+NAME = "runtexshebang"
+VERSION = "20230913 v0.4"
+USAGE = [[
+Usage: runtexshebang [input.tex]
+
+Options:
+ -h, --help print help
+ -v, --version print version
+
+See also:
+The command
+ texdoc runtexshebang
+should give you access to the README.
+]]
+
+function whoami()
+ print(NAME .. " " .. VERSION)
end
-local line_ctr = 0
-for line in io.lines(arg[1]) do
+function help()
+ whoami()
+ print()
+ print(USAGE)
+end
+
+if #arg == 0 then
+ help()
+ os.exit(0)
+end
+
+--
+texfilename = ""
+narg = 1
+repeat
+ this_arg = arg[narg]
+ -- replace double dash by single dash at the beginning
+ this_arg = string.gsub(this_arg, "^%-%-", "-")
+
+ if this_arg == "-h" or this_arg == "-help" then
+ help()
+ os.exit(0)
+ elseif this_arg == "-v" or this_arg == "-version" then
+ whoami()
+ os.exit(0)
+ else
+ texfilename = this_arg
+ end --if this_arg == ...
+ narg = narg+1
+until narg > #arg
+
+-- main process
+whoami()
+
+line_ctr = 0
+for line in io.lines(texfilename) do
line_ctr = line_ctr + 1
if line_ctr > 20 then break end
More information about the tex-live-commits
mailing list.