forked from LuaLS/lua-language-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.lua
More file actions
170 lines (164 loc) · 5.23 KB
/
help.lua
File metadata and controls
170 lines (164 loc) · 5.23 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
local util = require 'utility'
--- @class cli.arg
--- @field type? string|string[]
--- @field description string Description of the argument in markdown format.
--- @field example? string
--- @field default? any
--- @type table<string, cli.arg>
local args = {
['--help'] = {
description = [[
Print this message.
]],
},
['--check'] = {
type = 'string',
description = [[
Perform a "diagnosis report" where the results of the diagnosis are written to the logpath.
]],
example = [[--check=C:\Users\Me\path\to\workspace]]
},
['--checklevel'] = {
type = 'string',
description = [[
To be used with --check. The minimum level of diagnostic that should be logged.
Items with lower priority than the one listed here will not be written to the file.
Options include, in order of priority:
- Error
- Warning
- Information
- Hint
]],
default = 'Warning',
example = [[--checklevel=Information]]
},
['--check_format'] = {
type = { 'json', 'pretty' },
description = [[
Output format for the check results.
- 'pretty': results are displayed to stdout in a human-readable format.
- 'json': results are written to a file in JSON format. See --check_out_path
]],
default = 'pretty'
},
['--version'] = {
type = 'boolean',
description = [[
Get the version of the Lua language server.
This will print it to the command line and immediately exit.
]],
},
['--doc'] = {
type = 'string',
description = [[
Generate documentation from a workspace.
The files will be written to the documentation output path passed
in --doc_out_path.
]],
example = [[--doc=C:/Users/Me/Documents/myLuaProject/]]
},
['--doc_out_path'] = {
type = 'string',
description = [[
The path to output generated documentation at.
If --doc_out_path is missing, the documentation will be written
to the current directory.
See --doc for more info.
]],
example = [[--doc_out_path=C:/Users/Me/Documents/myLuaProjectDocumentation]]
},
['--doc_update'] = {
type = 'string',
description = [[
Update existing documentation files at the given path.
]]
},
['--logpath'] = {
type = 'string',
description = [[
Where the log should be written to.
]],
default = './log',
example = [[--logpath=D:/luaServer/logs]]
},
['--loglevel'] = {
type = 'string',
description = [[
The minimum level of logging that should appear in the logfile.
Can be used to log more detailed info for debugging and error reporting.
Options:
- error
- warn
- info
- debug
- trace
]],
example = [[--loglevel=trace]]
},
['--metapath'] = {
type = 'string',
description = [[
Where the standard Lua library definition files should be generated to.
]],
default = './meta',
example = [[--metapath=D:/sumnekoLua/metaDefintions]]
},
['--locale'] = {
type = 'string',
description = [[
The language to use. Defaults to en-us.
Options can be found in locale/ .
]],
example = [[--locale=zh-cn]]
},
['--configpath'] = {
type = 'string',
description = [[
The location of the configuration file that will be loaded.
Can be relative to the workspace.
When provided, config files from elsewhere (such as from VS Code) will no longer be loaded.
]],
example = [[--configpath=sumnekoLuaConfig.lua]]
},
['--force-accept-workspace'] = {
type = 'boolean',
description = [[
Allows the use of root/home directory as the workspace.
]]
},
['--socket'] = {
type = 'number',
description = [[
Will communicate to a client over the specified TCP port instead of through stdio.
]],
example = [[--socket=5050]]
},
['--develop'] = {
type = 'boolean',
description = [[
Enables development mode. This allows plugins to write to the logpath.
]]
}
}
for nm, attrs in util.sortPairs(args) do
if attrs.type == 'boolean' then
print(nm)
else
print(nm .. "=<value>")
end
if attrs.description then
local normalized_description = attrs.description:gsub("^%s+", ""):gsub("\n%s+", "\n"):gsub("%s+$", "")
print("\n " .. normalized_description:gsub('\n', '\n '))
end
local attr_type = attrs.type
if type(attr_type) == "table" then
print("\n Values: " .. table.concat(attr_type, ', '))
end
if attrs.default then
print("\n Default: " .. tostring(attrs.default))
end
if attrs.example then
print("\n Example: " .. attrs.example)
end
print()
end