diff options
| author | V1K1NGbg <victor@ilchev.com> | 2024-08-22 17:49:04 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-10-21 13:30:51 -0300 |
| commit | e66c352daf256ae19bd8aef78193f13dbf1b29c4 (patch) | |
| tree | 9d489fde4dcf477c2e77fca7e51a7b743cd019b0 /src | |
| parent | aa1c4422e919c67bd89faeefc855237e60393600 (diff) | |
| download | luarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.tar.gz luarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.tar.bz2 luarocks-e66c352daf256ae19bd8aef78193f13dbf1b29c4.zip | |
Teal: convert luarocks.cmd.remove
Diffstat (limited to 'src')
| -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. |
| 4 | local cmd_remove = {} | 4 | local record cmd_remove |
| 5 | needs_lock: function(Args): boolean | ||
| 6 | end | ||
| 5 | 7 | ||
| 6 | local remove = require("luarocks.remove") | 8 | local remove = require("luarocks.remove") |
| 7 | local util = require("luarocks.util") | 9 | local util = require("luarocks.util") |
| @@ -9,10 +11,13 @@ local cfg = require("luarocks.core.cfg") | |||
| 9 | local search = require("luarocks.search") | 11 | local search = require("luarocks.search") |
| 10 | local path = require("luarocks.path") | 12 | local path = require("luarocks.path") |
| 11 | local deps = require("luarocks.deps") | 13 | local deps = require("luarocks.deps") |
| 12 | local writer = require("luarocks.manif.writer") | ||
| 13 | local queries = require("luarocks.queries") | 14 | local queries = require("luarocks.queries") |
| 14 | 15 | ||
| 15 | function cmd_remove.add_to_parser(parser) | 16 | local type Parser = require("luarocks.vendor.argparse").Parser |
| 17 | |||
| 18 | local type Args = require("luarocks.core.types.args").Args | ||
| 19 | |||
| 20 | function 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", [[ |
| 18 | Uninstall a rock. | 23 | Uninstall 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) |
| 35 | end | 40 | end |
| 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. |
| 40 | function cmd_remove.command(args) | 45 | function 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 |
| 68 | end | 73 | end |
| 69 | 74 | ||
| 70 | cmd_remove.needs_lock = function() return true end | 75 | cmd_remove.needs_lock = function(): boolean return true end |
| 71 | 76 | ||
| 72 | return cmd_remove | 77 | return cmd_remove |
