summaryrefslogtreecommitdiff
path: root/Master/texmf/scripts/texdoc/constants.tlu
blob: a8c107034cc95b18132a26c4f5756a88483e65c5 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
-- Global "constants" for texdoc.
--[[ 
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.
-- A name 'foo' defined here will be globally visible as 'C.foo', see EOF.
local L = {}
load_env(L, {
    'setmetatable', 'arg',
})

-- progname and version
fullname    = arg[0]
progname    = 'texdoc'
version     = '0.80'

-- make sure to update setup_config_from_cl() accordingly
-- and set a default value in setup_config_from_defaults() if relevant
usage_msg = [[
Usage: texdoc [OPTION]... [NAME]...

Try to find appropriate TeX documentation for the specified NAME(s).
With no NAME, print information about texdoc (--help, --version, --files).

Current settings:

  -h, --help            Print this help message.
  -V, --version         Print the version number.
  -f, --files           Print the list of configuration files used.

  -w, --view            Use view mode: start a viewer. (default)
  -m, --mixed           Use mixed mode (view or list).
  -l, --list            Use list mode: show a list of results.
  -s, --showall         Use showall mode: show also "bad" results.

  -i, --interact        Use interactive menus. (default)
  -I, --nointeract      Use plain lists, no interaction required.
  -M, --machine         Machine-readable output for lists (implies -I).

  -q, --quiet           Suppress warnings and most error messages.
  -v, --verbose         Print additional information (eg, viewer command).
  -d, --debug[=list]    Print debug info for selected items (default: all).

Environment: PAGER, BROWSER, PDFVIEWER, PSVIEWER, DVIVIEWER.
Files: <texmf>/texdoc/texdoc.cnf, see output of the --files option.
Homepage: http://tug.org/texdoc/
Manual: displayed by `texdoc texdoc'.]]

usage_settings_ph = 'Current settings:' -- keep ../doc/texdoc wrapper in sync!
usage_settings = {
    { name = 'mode', view = '--view', mixed = '--mixed', list = '--list',
        showall = '--showall' },
    { name = 'interact_switch',
        [true] = '--interact', [false] = '--nointeract' },
}

known_options = {
    'viewer_.*',
    'mode',
    'interact_switch',
    'machine_switch',
    'alias_switch',
    'ext_list',
    'basename_list',
    'badext_list',
    'badbasename_list',
    'suffix_list',
    'verbosity_level',
    'debug_list',
    'lastfile_switch',
    'rm_dir',
    'rm_file',
    'unzip_.*',
    'zipext_list',
    'max_lines',
    'lang',
}

error_msg = [[
Try `texdoc --help' for a short help, `texdoc texdoc' for the user manual.]]
notfound_msg = [[
Sorry, no documentation found for PKGNAME.
If you are unsure about the name, try searching CTAN's TeX catalogue at
http://ctan.org/search.html#byDescription.]]
notfound_msg_ph = 'PKGNAME'

err_priority = {
    error   = 1,
    warning = 2,
    info    = 3,
}
min_verbosity='0'
max_verbosity='3'
def_verbosity='2'

exit_ok = 0
exit_error = 1 -- apparently hard-coded in Lua
exit_usage = 2

known_debugs = {
    version = {},
    files   = {},
    config  = {'files'},
    view    = {},
    texdocs = {},
    score   = {},
    tlpdb   = {}
}

-- various cache or non-cache files
cache_name = 'texdoc/cache-tlpdb.lua' -- relative to TEXMFVAR
data_meta_name = 'Data.meta.lua'
data_tlpdb_name = 'Data.tlpdb.lua'

place_holder = '%%s' -- used for viewer commands

-- Make global C a read-only proxy to the local environment.
-- Note this is not deep read-only: C.known_debugs is read-only, but
-- C.known_debugs.version isn't, for instance.
assert(next(C) == nil,
    'Internal error: table of constants should be empty at this point')
setmetatable(C, {
    __index = L,
    __newindew = function ()
        error('Internal error: attempt to modify a constant.')
    end
})