diff options
| author | V1K1NGbg <victor@ilchev.com> | 2024-08-22 17:49:07 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-10-21 13:30:51 -0300 |
| commit | 2b14ed6d3906b436a4a58683385001a3bfedb117 (patch) | |
| tree | faeafefcdfa4f95ab43d83b15f74a5401b708926 /src | |
| parent | 20488302b00fed7675c65280c84db078c64ee36f (diff) | |
| download | luarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.tar.gz luarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.tar.bz2 luarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.zip | |
Teal: convert luarocks.admin.cmd.refresh_cache
Diffstat (limited to 'src')
| -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) |
