aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/cmd/lint.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/cmd/lint.lua')
-rw-r--r--src/luarocks/cmd/lint.lua31
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")
7local download = require("luarocks.download") 7local download = require("luarocks.download")
8local fetch = require("luarocks.fetch") 8local fetch = require("luarocks.fetch")
9 9
10lint.help_summary = "Check syntax of a rockspec." 10function lint.add_to_parser(parser)
11lint.help_arguments = "<rockspec>" 11 local cmd = parser:command("lint", "Check syntax of a rockspec.\n\n"..
12lint.help = [[ 12 "Returns success if the text of the rockspec is syntactically correct, else failure.",
13This is a utility function that checks the syntax of a rockspec. 13 util.see_also())
14 14 :summary("Check syntax of a rockspec.")
15It returns success or failure if the text of a rockspec is 15
16syntactically correct. 16 cmd:argument("rockspec", "The rockspec to check.")
17]] 17end
18 18
19function lint.command(flags, input) 19function 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