aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-22 17:49:03 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-10-21 13:30:51 -0300
commit97339f0e9542b96137f72c10333c86723d2b0a2d (patch)
tree421f7b06542cecadb264febedb902a571c5b9aee
parente835049ce5eb087462da8ffc540efa5ea481ee34 (diff)
downloadluarocks-97339f0e9542b96137f72c10333c86723d2b0a2d.tar.gz
luarocks-97339f0e9542b96137f72c10333c86723d2b0a2d.tar.bz2
luarocks-97339f0e9542b96137f72c10333c86723d2b0a2d.zip
Teal: convert luarocks.cmd.lint
-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.
4local lint = {} 4local record lint
5end
5 6
6local util = require("luarocks.util") 7local util = require("luarocks.util")
7local download = require("luarocks.download") 8local download = require("luarocks.download")
8local fetch = require("luarocks.fetch") 9local fetch = require("luarocks.fetch")
9 10
10function lint.add_to_parser(parser) 11local type Parser = require("luarocks.vendor.argparse").Parser
12
13local type Args = require("luarocks.core.types.args").Args
14
15function 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.")
17end 22end
18 23
19function lint.command(args) 24function 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."
48end 57end
49 58
50return lint 59return lint