texlive[45611] Master/texmf-dist/scripts/texdoc: prioritize
commits+karl at tug.org
commits+karl at tug.org
Fri Oct 27 00:32:17 CEST 2017
Revision: 45611
http://tug.org/svn/texlive?view=revision&revision=45611
Author: karl
Date: 2017-10-27 00:32:17 +0200 (Fri, 27 Oct 2017)
Log Message:
-----------
prioritize get_doclist_texdocs over get_doclist_tlpdb; cmdline parsing (texdoc r15,r16)
Revision Links:
--------------
http://tug.org/svn/texlive?view=revision&revision=15
http://tug.org/svn/texlive?view=revision&revision=16
Modified Paths:
--------------
trunk/Master/texmf-dist/scripts/texdoc/config.tlu
trunk/Master/texmf-dist/scripts/texdoc/main.tlu
trunk/Master/texmf-dist/scripts/texdoc/search.tlu
Modified: trunk/Master/texmf-dist/scripts/texdoc/config.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/config.tlu 2017-10-26 22:06:36 UTC (rev 45610)
+++ trunk/Master/texmf-dist/scripts/texdoc/config.tlu 2017-10-26 22:32:17 UTC (rev 45611)
@@ -1,4 +1,4 @@
--- $Id: config.tlu 6 2017-05-11 15:43:32Z karl $
+-- $Id: config.tlu 16 2017-10-26 22:28:24Z karl $
-- config.tlu: configuration handling for texdoc
--
-- Manuel Pégourié-Gonnard, GPLv3+, see texdoclib.tlu for details
@@ -132,13 +132,24 @@
-- and set a default value in setup_config_from_defaults() if relevant.
function setup_config_from_cl(arg)
local curr_arg
+ local action = true
local function set_config_elt(key, val)
set_config_element(key, val, {src='cl', name=curr_arg})
end
while arg[1] and string.match(arg[1],'^%-') do
curr_arg = table.remove(arg,1)
+
+ -- action
+ if (curr_arg == '-h') or (curr_arg == '--help') then
+ action = 'help'
+ elseif (curr_arg == '-V') or (curr_arg == '--version') then
+ action = 'version'
+ elseif (curr_arg == '-f') or (curr_arg == '--files') then
+ action = 'files'
+ elseif curr_arg == '--just-view' then
+ action = 'view'
-- mode
- if (curr_arg == '-w') or (curr_arg == '--view') then
+ elseif (curr_arg == '-w') or (curr_arg == '--view') then
set_config_elt('mode', 'view')
elseif (curr_arg == '-m') or (curr_arg == '--mixed') then
set_config_elt('mode', 'mixed')
@@ -175,7 +186,7 @@
return false
end
end
- return true
+ return action
end
------------------------- config from environment --------------------------
Modified: trunk/Master/texmf-dist/scripts/texdoc/main.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/main.tlu 2017-10-26 22:06:36 UTC (rev 45610)
+++ trunk/Master/texmf-dist/scripts/texdoc/main.tlu 2017-10-26 22:32:17 UTC (rev 45611)
@@ -10,31 +10,16 @@
local exit_error = 1 -- apparently hard-coded in Lua
local exit_usage = 2
--- action command-line options, not treated by setup_config_and_alias
+-- action command-line options
local action_help = [[
-h, --help Print this help message.
-V, --version Print the version number.
-f, --files Print the list of configuration files used.
--just-view file Display file, given with full path (no searching).]]
-local action_opts = {
- ['-h'] = 'help',
- ['--help'] = 'help',
- ['-V'] = 'version',
- ['--version'] = 'version',
- ['-f'] = 'files',
- ['--files'] = 'files',
- ['--just-view'] = 'view',
-}
--- detect action options, but do not act now (some need setup_config)
-local action
-if arg[1] then
- action = action_opts[arg[1]]
- if action then table.remove(arg, 1) end
-end
-
--- get configuration
-if not texdoc.setup_config_and_alias(arg) then
+-- get configuration and parse command line
+local action = texdoc.setup_config_and_alias(arg)
+if not action then
os.exit(exit_usage)
end
@@ -46,7 +31,7 @@
print(texdoc.const.progname .. ' ' .. texdoc.const.version)
print('\n' .. texdoc.const.copyright_msg)
os.exit(exit_ok)
-elseif action =='files' then
+elseif action == 'files' then
print(texdoc.const.fullname .. ' ' .. texdoc.const.version)
texdoc.show_config_files(print, true)
os.exit(exit_ok)
Modified: trunk/Master/texmf-dist/scripts/texdoc/search.tlu
===================================================================
--- trunk/Master/texmf-dist/scripts/texdoc/search.tlu 2017-10-26 22:06:36 UTC (rev 45610)
+++ trunk/Master/texmf-dist/scripts/texdoc/search.tlu 2017-10-26 22:32:17 UTC (rev 45611)
@@ -611,10 +611,12 @@
local normal, sty = normal_vs_sty(get_patterns(pattern, no_alias))
-- initialise result list
s_doclist = Doclist:new()
- -- get results
+ -- get results; _texdocs search comes after _tlpdb search so that
+ -- files found by both will have the priority of the _texdocs tree.
+ -- (https://puszcza.gnu.org.ua/bugs/?369)
get_doclist_sty(sty)
+ get_doclist_tlpdb(pattern)
get_doclist_texdocs(normal)
- get_doclist_tlpdb(pattern)
-- finally, sort results
sort_doclist(s_doclist, pattern)
return s_doclist
More information about the tex-live-commits
mailing list