summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-11-18 20:55:22 +0000
committerKarl Berry <karl@freefriends.org>2023-11-18 20:55:22 +0000
commit08cc56495344a80820418fd87c2201711cd06be0 (patch)
treee2789031042204311cc6ee1674b09298283a276b /Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
parentafaa9b579c6a9382f5011372cc31fc2f658e8ce4 (diff)
cluttex (18nov23)
git-svn-id: svn://tug.org/texlive/trunk@68891 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua')
-rw-r--r--Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
index 8d44567b468..937d4d5a575 100644
--- a/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
+++ b/Master/texmf-dist/doc/support/cluttex/src/texrunner/handleoption.lua
@@ -1,5 +1,5 @@
local COPYRIGHT_NOTICE = [[
-Copyright (C) 2016-2021 ARATA Mizuki
+Copyright (C) 2016-2023 ARATA Mizuki
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -47,8 +47,9 @@ Options:
cross-references. [default: 3]
--start-with-draft Start with draft mode.
--[no-]change-directory Change directory before running TeX.
- --watch Watch input files for change. Requires fswatch
- program to be installed.
+ --watch[=ENGINE] Watch input files for change. Requires fswatch
+ or inotifywait to be installed. ENGINE is one of
+ `fswatch', `inotifywait' or `auto' [default: `auto']
--tex-option=OPTION Pass OPTION to TeX as a single option.
--tex-options=OPTIONs Pass OPTIONs to TeX as multiple options.
--dvipdfmx-option[s]=OPTION[s] Same for dvipdfmx.
@@ -122,6 +123,8 @@ local option_spec = {
},
{
long = "watch",
+ param = true,
+ default = "auto",
},
{
short = "h",
@@ -312,7 +315,7 @@ local function handle_cluttex_options(arg)
elseif name == "watch" then
assert(options.watch == nil, "multiple --watch options")
- options.watch = true
+ options.watch = param
elseif name == "help" then
usage(arg)
@@ -470,6 +473,15 @@ local function handle_cluttex_options(arg)
set_default_values(options)
+ -- parameter validy check TODO should this be organized as function like
+ -- set_default_values and with a key in the option spec (list or function)?
+ if options.watch then
+ if options.watch ~= "fswatch" and options.watch ~= "inotifywait" then
+ message.error("Unknown wait engine '", options.watch, "'.")
+ os.exit(1)
+ end
+ end
+
if options.output_format == "pdf" then
if options.check_driver ~= nil then
error("--check-driver can only be used when the output format is DVI.")