diff options
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 |
