diff options
-rw-r--r-- | src/luarocks/admin/cmd/refresh_cache.tl (renamed from src/luarocks/admin/cmd/refresh_cache.lua) | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/luarocks/admin/cmd/refresh_cache.lua b/src/luarocks/admin/cmd/refresh_cache.tl index f8d51893..07480159 100644 --- a/src/luarocks/admin/cmd/refresh_cache.lua +++ b/src/luarocks/admin/cmd/refresh_cache.tl | |||
@@ -1,12 +1,17 @@ | |||
1 | 1 | ||
2 | --- Module implementing the luarocks-admin "refresh_cache" command. | 2 | --- Module implementing the luarocks-admin "refresh_cache" command. |
3 | local refresh_cache = {} | 3 | local record refresh_cache |
4 | end | ||
4 | 5 | ||
5 | local cfg = require("luarocks.core.cfg") | 6 | local cfg = require("luarocks.core.cfg") |
6 | local util = require("luarocks.util") | 7 | local util = require("luarocks.util") |
7 | local cache = require("luarocks.admin.cache") | 8 | local cache = require("luarocks.admin.cache") |
8 | 9 | ||
9 | function refresh_cache.add_to_parser(parser) | 10 | local type Parser = require("luarocks.vendor.argparse").Parser |
11 | |||
12 | local type Args = require("luarocks.core.types.args").Args | ||
13 | |||
14 | function refresh_cache.add_to_parser(parser: Parser) | ||
10 | local cmd = parser:command("refresh_cache", "Refresh local cache of a remote rocks server.", util.see_also()) | 15 | local cmd = parser:command("refresh_cache", "Refresh local cache of a remote rocks server.", util.see_also()) |
11 | 16 | ||
12 | cmd:option("--from", "The server to use. If not given, the default server ".. | 17 | cmd:option("--from", "The server to use. If not given, the default server ".. |
@@ -14,9 +19,9 @@ function refresh_cache.add_to_parser(parser) | |||
14 | :argname("<server>") | 19 | :argname("<server>") |
15 | end | 20 | end |
16 | 21 | ||
17 | function refresh_cache.command(args) | 22 | function refresh_cache.command(args: Args): boolean, string |
18 | local server, upload_server = cache.get_upload_server(args.server) | 23 | local server, upload_server, err = cache.get_upload_server(args.server) |
19 | if not server then return nil, upload_server end | 24 | if not server then return nil, err end |
20 | local download_url = cache.get_server_urls(server, upload_server) | 25 | local download_url = cache.get_server_urls(server, upload_server) |
21 | 26 | ||
22 | local ok, err = cache.refresh_local_cache(download_url, cfg.upload_user, cfg.upload_password) | 27 | local ok, err = cache.refresh_local_cache(download_url, cfg.upload_user, cfg.upload_password) |