summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc/main.tlu
blob: 0748df0b7d2c1d1d623796ac790e3c907662d287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- texdoc's main()
--[[ 
Copyright 2008, 2009 Manuel Pégourié-Gonnard
Distributed under the terms of the GNU GPL version 3 or later.
See texdoc.tlu for details.
--]]

-- Load a private environment for this submodule (see texdoc.tlu).
local L = {}
load_env(L, {
    'os', 'arg', 'print',
    'setup_config_and_alias', 'init_databases',
    'get_doclist', 'deliver_results', 'aliased_names',
})

-- get started
setup_config_and_alias(arg)
init_databases()

-- make sure we actually have argument(s)
if not arg[1] then
    print_usage()
    os.exit(C.exit_usage)
end

-- main loop
local docname
for _, docname in ipairs(arg) do
    -- do we have more then one argument?
    local multiarg = not not arg[2]
    -- get results
    local doclist = get_doclist(docname)
    -- deliver results to the user
    deliver_results(docname, doclist, multiarg)
end