diff options
author | V1K1NGbg <victor@ilchev.com> | 2024-08-22 17:49:02 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-10-21 13:30:51 -0300 |
commit | f6000e9050c4e0d3b9c06809802abdefb7d01bb2 (patch) | |
tree | 431e777b90612f00e296707f3b20972a26795466 | |
parent | 98e9f4a233c12136d8ae1231c7e3263240cc7e4a (diff) | |
download | luarocks-f6000e9050c4e0d3b9c06809802abdefb7d01bb2.tar.gz luarocks-f6000e9050c4e0d3b9c06809802abdefb7d01bb2.tar.bz2 luarocks-f6000e9050c4e0d3b9c06809802abdefb7d01bb2.zip |
Teal: convert luarocks.cmd.pack
-rw-r--r-- | src/luarocks/cmd/pack.tl (renamed from src/luarocks/cmd/pack.lua) | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/luarocks/cmd/pack.lua b/src/luarocks/cmd/pack.tl index 29a43e7b..750ae9c9 100644 --- a/src/luarocks/cmd/pack.lua +++ b/src/luarocks/cmd/pack.tl | |||
@@ -1,13 +1,18 @@ | |||
1 | 1 | ||
2 | --- Module implementing the LuaRocks "pack" command. | 2 | --- Module implementing the LuaRocks "pack" command. |
3 | -- Creates a rock, packing sources or binaries. | 3 | -- Creates a rock, packing sources or binaries. |
4 | local cmd_pack = {} | 4 | local record cmd_pack |
5 | end | ||
5 | 6 | ||
6 | local util = require("luarocks.util") | 7 | local util = require("luarocks.util") |
7 | local pack = require("luarocks.pack") | 8 | local pack = require("luarocks.pack") |
8 | local queries = require("luarocks.queries") | 9 | local queries = require("luarocks.queries") |
9 | 10 | ||
10 | function cmd_pack.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 cmd_pack.add_to_parser(parser: Parser) | ||
11 | local cmd = parser:command("pack", "Create a rock, packing sources or binaries.", util.see_also()) | 16 | local cmd = parser:command("pack", "Create a rock, packing sources or binaries.", util.see_also()) |
12 | 17 | ||
13 | cmd:argument("rock", "A rockspec file, for creating a source rock, or the ".. | 18 | cmd:argument("rock", "A rockspec file, for creating a source rock, or the ".. |
@@ -22,8 +27,8 @@ end | |||
22 | --- Driver function for the "pack" command. | 27 | --- Driver function for the "pack" command. |
23 | -- @return boolean or (nil, string): true if successful or nil followed | 28 | -- @return boolean or (nil, string): true if successful or nil followed |
24 | -- by an error message. | 29 | -- by an error message. |
25 | function cmd_pack.command(args) | 30 | function cmd_pack.command(args: Args): boolean, string |
26 | local file, err | 31 | local file, err: string, string |
27 | if args.rock:match(".*%.rockspec") then | 32 | if args.rock:match(".*%.rockspec") then |
28 | file, err = pack.pack_source_rock(args.rock) | 33 | file, err = pack.pack_source_rock(args.rock) |
29 | else | 34 | else |