diff options
Diffstat (limited to 'src/luarocks/cmd/lint.lua')
-rw-r--r-- | src/luarocks/cmd/lint.lua | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/src/luarocks/cmd/lint.lua b/src/luarocks/cmd/lint.lua index c9ea45ea..20c842ff 100644 --- a/src/luarocks/cmd/lint.lua +++ b/src/luarocks/cmd/lint.lua | |||
@@ -7,24 +7,21 @@ local util = require("luarocks.util") | |||
7 | local download = require("luarocks.download") | 7 | local download = require("luarocks.download") |
8 | local fetch = require("luarocks.fetch") | 8 | local fetch = require("luarocks.fetch") |
9 | 9 | ||
10 | lint.help_summary = "Check syntax of a rockspec." | 10 | function lint.add_to_parser(parser) |
11 | lint.help_arguments = "<rockspec>" | 11 | local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n".. |
12 | lint.help = [[ | 12 | "Returns success if the text of the rockspec is syntactically correct, else failure.", |
13 | This is a utility function that checks the syntax of a rockspec. | 13 | util.see_also()) |
14 | 14 | :summary("Check syntax of a rockspec.") | |
15 | It returns success or failure if the text of a rockspec is | 15 | |
16 | syntactically correct. | 16 | cmd:argument("rockspec", "The rockspec to check.") |
17 | ]] | 17 | end |
18 | 18 | ||
19 | function lint.command(flags, input) | 19 | function lint.command(args) |
20 | if not input then | 20 | |
21 | return nil, "Argument missing. "..util.see_help("lint") | 21 | local filename = args.rockspec |
22 | end | 22 | if not filename:match(".rockspec$") then |
23 | |||
24 | local filename = input | ||
25 | if not input:match(".rockspec$") then | ||
26 | local err | 23 | local err |
27 | filename, err = download.download("rockspec", input:lower()) | 24 | filename, err = download.download("rockspec", filename:lower()) |
28 | if not filename then | 25 | if not filename then |
29 | return nil, err | 26 | return nil, err |
30 | end | 27 | end |