aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-08-22 17:49:07 -0300
committerHisham Muhammad <hisham@gobolinux.org>2024-10-21 13:30:51 -0300
commit2b14ed6d3906b436a4a58683385001a3bfedb117 (patch)
treefaeafefcdfa4f95ab43d83b15f74a5401b708926
parent20488302b00fed7675c65280c84db078c64ee36f (diff)
downloadluarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.tar.gz
luarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.tar.bz2
luarocks-2b14ed6d3906b436a4a58683385001a3bfedb117.zip
Teal: convert luarocks.admin.cmd.refresh_cache
-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.
3local refresh_cache = {} 3local record refresh_cache
4end
4 5
5local cfg = require("luarocks.core.cfg") 6local cfg = require("luarocks.core.cfg")
6local util = require("luarocks.util") 7local util = require("luarocks.util")
7local cache = require("luarocks.admin.cache") 8local cache = require("luarocks.admin.cache")
8 9
9function refresh_cache.add_to_parser(parser) 10local type Parser = require("luarocks.vendor.argparse").Parser
11
12local type Args = require("luarocks.core.types.args").Args
13
14function 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>")
15end 20end
16 21
17function refresh_cache.command(args) 22function 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)