diff options
-rw-r--r-- | src/luarocks/cmd/lint.tl (renamed from src/luarocks/cmd/lint.lua) | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/luarocks/cmd/lint.lua b/src/luarocks/cmd/lint.tl index 738503ce..116dba12 100644 --- a/src/luarocks/cmd/lint.lua +++ b/src/luarocks/cmd/lint.tl | |||
@@ -1,13 +1,18 @@ | |||
1 | 1 | ||
2 | --- Module implementing the LuaRocks "lint" command. | 2 | --- Module implementing the LuaRocks "lint" command. |
3 | -- Utility function that checks syntax of the rockspec. | 3 | -- Utility function that checks syntax of the rockspec. |
4 | local lint = {} | 4 | local record lint |
5 | end | ||
5 | 6 | ||
6 | local util = require("luarocks.util") | 7 | local util = require("luarocks.util") |
7 | local download = require("luarocks.download") | 8 | local download = require("luarocks.download") |
8 | local fetch = require("luarocks.fetch") | 9 | local fetch = require("luarocks.fetch") |
9 | 10 | ||
10 | function lint.add_to_parser(parser) | 11 | local type Parser = require("luarocks.vendor.argparse").Parser |
12 | |||
13 | local type Args = require("luarocks.core.types.args").Args | ||
14 | |||
15 | function lint.add_to_parser(parser: Parser) | ||
11 | local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n".. | 16 | local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n".. |
12 | "Returns success if the text of the rockspec is syntactically correct, else failure.", | 17 | "Returns success if the text of the rockspec is syntactically correct, else failure.", |
13 | util.see_also()) | 18 | util.see_also()) |
@@ -16,12 +21,12 @@ function lint.add_to_parser(parser) | |||
16 | cmd:argument("rockspec", "The rockspec to check.") | 21 | cmd:argument("rockspec", "The rockspec to check.") |
17 | end | 22 | end |
18 | 23 | ||
19 | function lint.command(args) | 24 | function lint.command(args: Args): boolean, string, string |
20 | 25 | ||
21 | local filename = args.rockspec | 26 | local filename = args.rockspec |
22 | if not filename:match(".rockspec$") then | 27 | if not filename:match(".rockspec$") then |
23 | local err | 28 | local err: string |
24 | filename, err = download.download("rockspec", filename:lower()) | 29 | filename, err = download.download_file("rockspec", filename:lower()) |
25 | if not filename then | 30 | if not filename then |
26 | return nil, err | 31 | return nil, err |
27 | end | 32 | end |
@@ -44,7 +49,11 @@ function lint.command(args) | |||
44 | ok = false | 49 | ok = false |
45 | end | 50 | end |
46 | 51 | ||
47 | return ok, ok or filename.." failed consistency checks." | 52 | if ok then |
53 | return ok | ||
54 | end | ||
55 | |||
56 | return nil, filename.." failed consistency checks." | ||
48 | end | 57 | end |
49 | 58 | ||
50 | return lint | 59 | return lint |