diff options
author | Karl Berry <karl@freefriends.org> | 2017-10-26 22:32:17 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-10-26 22:32:17 +0000 |
commit | c7d293b1d9434fe1e1a541f20461efd80ad7dc75 (patch) | |
tree | 0b86d15c1ba3deb54619a534c37d8b5889b55cb1 /Master | |
parent | 3362365a833979f19cc8fde42cbc789e1b368180 (diff) |
prioritize get_doclist_texdocs over get_doclist_tlpdb; cmdline parsing (texdoc r15,r16)
git-svn-id: svn://tug.org/texlive/trunk@45611 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/scripts/texdoc/config.tlu | 17 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/texdoc/main.tlu | 25 | ||||
-rw-r--r-- | Master/texmf-dist/scripts/texdoc/search.tlu | 6 |
3 files changed, 23 insertions, 25 deletions
diff --git a/Master/texmf-dist/scripts/texdoc/config.tlu b/Master/texmf-dist/scripts/texdoc/config.tlu index e7a7c369e4f..42d2e779055 100644 --- a/Master/texmf-dist/scripts/texdoc/config.tlu +++ b/Master/texmf-dist/scripts/texdoc/config.tlu @@ -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 @@ end -- 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 @@ function setup_config_from_cl(arg) return false end end - return true + return action end ------------------------- config from environment -------------------------- diff --git a/Master/texmf-dist/scripts/texdoc/main.tlu b/Master/texmf-dist/scripts/texdoc/main.tlu index 8ab4648e770..3b5aa3a421c 100644 --- a/Master/texmf-dist/scripts/texdoc/main.tlu +++ b/Master/texmf-dist/scripts/texdoc/main.tlu @@ -10,31 +10,16 @@ local exit_ok = 0 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 @@ elseif action == 'version' then 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) diff --git a/Master/texmf-dist/scripts/texdoc/search.tlu b/Master/texmf-dist/scripts/texdoc/search.tlu index 1499c65414a..3fb77c1a1be 100644 --- a/Master/texmf-dist/scripts/texdoc/search.tlu +++ b/Master/texmf-dist/scripts/texdoc/search.tlu @@ -611,10 +611,12 @@ function get_doclist(pattern, no_alias) 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_texdocs(normal) get_doclist_tlpdb(pattern) + get_doclist_texdocs(normal) -- finally, sort results sort_doclist(s_doclist, pattern) return s_doclist |