diff options
| author | V1K1NGbg <victor@ilchev.com> | 2024-08-22 17:49:00 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-10-21 13:30:51 -0300 |
| commit | 55e67af4ef25d83432a8ccdb40baea10137f9e59 (patch) | |
| tree | 9f75f5ec34e6817e115a41133b482f1afa66431a /src | |
| parent | 8286ac6ca0a0d17b72132c5cfab4eadea7c5d384 (diff) | |
| download | luarocks-55e67af4ef25d83432a8ccdb40baea10137f9e59.tar.gz luarocks-55e67af4ef25d83432a8ccdb40baea10137f9e59.tar.bz2 luarocks-55e67af4ef25d83432a8ccdb40baea10137f9e59.zip | |
Teal: convert luarocks.cmd.which
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/cmd/which.tl (renamed from src/luarocks/cmd/which.lua) | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/luarocks/cmd/which.lua b/src/luarocks/cmd/which.tl index f50a43c3..85a798ac 100644 --- a/src/luarocks/cmd/which.lua +++ b/src/luarocks/cmd/which.tl | |||
| @@ -1,13 +1,18 @@ | |||
| 1 | 1 | ||
| 2 | --- @module luarocks.which_cmd | 2 | --- @module luarocks.which_cmd |
| 3 | -- Driver for the `luarocks which` command. | 3 | -- Driver for the `luarocks which` command. |
| 4 | local which_cmd = {} | 4 | local record which_cmd |
| 5 | end | ||
| 5 | 6 | ||
| 6 | local loader = require("luarocks.loader") | 7 | local loader = require("luarocks.loader") |
| 7 | local cfg = require("luarocks.core.cfg") | 8 | local cfg = require("luarocks.core.cfg") |
| 8 | local util = require("luarocks.util") | 9 | local util = require("luarocks.util") |
| 9 | 10 | ||
| 10 | function which_cmd.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 which_cmd.add_to_parser(parser: Parser) | ||
| 11 | local cmd = parser:command("which", 'Given a module name like "foo.bar", '.. | 16 | local cmd = parser:command("which", 'Given a module name like "foo.bar", '.. |
| 12 | "output which file would be loaded to resolve that module by ".. | 17 | "output which file would be loaded to resolve that module by ".. |
| 13 | 'luarocks.loader, like "/usr/local/lua/'..cfg.lua_version..'/foo/bar.lua".', | 18 | 'luarocks.loader, like "/usr/local/lua/'..cfg.lua_version..'/foo/bar.lua".', |
| @@ -19,7 +24,7 @@ end | |||
| 19 | 24 | ||
| 20 | --- Driver function for "which" command. | 25 | --- Driver function for "which" command. |
| 21 | -- @return boolean This function terminates the interpreter. | 26 | -- @return boolean This function terminates the interpreter. |
| 22 | function which_cmd.command(args) | 27 | function which_cmd.command(args: Args): boolean, string |
| 23 | local pathname, rock_name, rock_version, where = loader.which(args.modname, "lp") | 28 | local pathname, rock_name, rock_version, where = loader.which(args.modname, "lp") |
| 24 | 29 | ||
| 25 | if pathname then | 30 | if pathname then |
