aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-22 17:49:04 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-10-21 13:30:51 -0300
commite66c352daf256ae19bd8aef78193f13dbf1b29c4 (patch)
tree9d489fde4dcf477c2e77fca7e51a7b743cd019b0
parentaa1c4422e919c67bd89faeefc855237e60393600 (diff)
downloadluarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.tar.gz
luarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.tar.bz2
luarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.zip
Teal: convert luarocks.cmd.remove
-rw-r--r--src/luarocks/cmd/remove.tl (renamed from src/luarocks/cmd/remove.lua)19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/luarocks/cmd/remove.lua b/src/luarocks/cmd/remove.tl
index 8b11bcd3..77ee359d 100644
--- a/src/luarocks/cmd/remove.lua
+++ b/src/luarocks/cmd/remove.tl
@@ -1,7 +1,9 @@
1 1
2--- Module implementing the LuaRocks "remove" command. 2--- Module implementing the LuaRocks "remove" command.
3-- Uninstalls rocks. 3-- Uninstalls rocks.
4local cmd_remove = {} 4local record cmd_remove
5 needs_lock: function(Args): boolean
6end
5 7
6local remove = require("luarocks.remove") 8local remove = require("luarocks.remove")
7local util = require("luarocks.util") 9local util = require("luarocks.util")
@@ -9,10 +11,13 @@ local cfg = require("luarocks.core.cfg")
9local search = require("luarocks.search") 11local search = require("luarocks.search")
10local path = require("luarocks.path") 12local path = require("luarocks.path")
11local deps = require("luarocks.deps") 13local deps = require("luarocks.deps")
12local writer = require("luarocks.manif.writer")
13local queries = require("luarocks.queries") 14local queries = require("luarocks.queries")
14 15
15function cmd_remove.add_to_parser(parser) 16local type Parser = require("luarocks.vendor.argparse").Parser
17
18local type Args = require("luarocks.core.types.args").Args
19
20function cmd_remove.add_to_parser(parser: Parser)
16 -- luacheck: push ignore 431 21 -- luacheck: push ignore 431
17 local cmd = parser:command("remove", [[ 22 local cmd = parser:command("remove", [[
18Uninstall a rock. 23Uninstall a rock.
@@ -31,13 +36,13 @@ To override this check and force the removal, use --force or --force-fast.]],
31 36
32 cmd:flag("--force", "Force removal if it would break dependencies.") 37 cmd:flag("--force", "Force removal if it would break dependencies.")
33 cmd:flag("--force-fast", "Perform a forced removal without reporting dependency issues.") 38 cmd:flag("--force-fast", "Perform a forced removal without reporting dependency issues.")
34 util.deps_mode_option(cmd) 39 util.deps_mode_option(cmd as Parser)
35end 40end
36 41
37--- Driver function for the "remove" command. 42--- Driver function for the "remove" command.
38-- @return boolean or (nil, string, exitcode): True if removal was 43-- @return boolean or (nil, string, exitcode): True if removal was
39-- successful, nil and an error message otherwise. exitcode is optionally returned. 44-- successful, nil and an error message otherwise. exitcode is optionally returned.
40function cmd_remove.command(args) 45function cmd_remove.command(args: Args): boolean, string
41 local name = args.rock 46 local name = args.rock
42 local deps_mode = deps.get_deps_mode(args) 47 local deps_mode = deps.get_deps_mode(args)
43 48
@@ -63,10 +68,10 @@ function cmd_remove.command(args)
63 return nil, err 68 return nil, err
64 end 69 end
65 70
66 writer.check_dependencies(nil, deps.get_deps_mode(args)) 71 deps.check_dependencies(nil, deps.get_deps_mode(args))
67 return true 72 return true
68end 73end
69 74
70cmd_remove.needs_lock = function() return true end 75cmd_remove.needs_lock = function(): boolean return true end
71 76
72return cmd_remove 77return cmd_remove