mirror of
https://github.com/RubyMetric/chsrc
synced 2025-06-09 20:34:08 +08:00
parent
b77c7f5390
commit
d030f9adb5
@ -7,7 +7,7 @@
|
|||||||
* Contributors : Peng Gao <gn3po4g@outlook.com>
|
* Contributors : Peng Gao <gn3po4g@outlook.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-29>
|
* Created On : <2023-08-29>
|
||||||
* Last Modified : <2024-09-13>
|
* Last Modified : <2024-09-29>
|
||||||
*
|
*
|
||||||
* chsrc 框架
|
* chsrc 框架
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
@ -33,7 +33,6 @@ bool CliOpt_Locally = false;
|
|||||||
bool CliOpt_InEnglish = false;
|
bool CliOpt_InEnglish = false;
|
||||||
bool CliOpt_DryRun = false;
|
bool CliOpt_DryRun = false;
|
||||||
bool CliOpt_NoColor = false;
|
bool CliOpt_NoColor = false;
|
||||||
bool CliOpt_Parallel = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* -local 的含义是启用 *项目级* 换源
|
* -local 的含义是启用 *项目级* 换源
|
||||||
@ -419,10 +418,7 @@ measure_speed_for_url (void *url)
|
|||||||
{
|
{
|
||||||
char *time_sec = NULL;
|
char *time_sec = NULL;
|
||||||
|
|
||||||
if (CliOpt_Parallel)
|
time_sec = "8";
|
||||||
time_sec = "9";
|
|
||||||
else
|
|
||||||
time_sec = "6";
|
|
||||||
|
|
||||||
/* 现在我们切换至跳转后的链接来测速,不再使用下述判断
|
/* 现在我们切换至跳转后的链接来测速,不再使用下述判断
|
||||||
if (xy_str_start_with(url, "https://registry.npmmirror"))
|
if (xy_str_start_with(url, "https://registry.npmmirror"))
|
||||||
@ -575,9 +571,6 @@ measure_speed_for_every_source (SourceInfo sources[], int size, double speed_rec
|
|||||||
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
measure_msgs[i] = xy_strjoin (3, " - ", msg, " ... ");
|
||||||
printf ("%s", measure_msgs[i]);
|
printf ("%s", measure_msgs[i]);
|
||||||
|
|
||||||
if (CliOpt_Parallel)
|
|
||||||
say (""); /* 并行时直接显示下一测速状态行 */
|
|
||||||
else
|
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
|
|
||||||
char *url_ = xy_strdup (url);
|
char *url_ = xy_strdup (url);
|
||||||
@ -601,13 +594,7 @@ int
|
|||||||
select_mirror_autoly (SourceInfo *sources, size_t size, const char *target_name)
|
select_mirror_autoly (SourceInfo *sources, size_t size, const char *target_name)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
char *msg = NULL;
|
char *msg = CliOpt_InEnglish ? "Measuring speed in sequence" : "测速中";
|
||||||
|
|
||||||
if (CliOpt_Parallel)
|
|
||||||
msg = CliOpt_InEnglish ? "Measuring speed in parallel. We recommend you use the default sequential measure for more referential results"
|
|
||||||
: "即将并行测速,建议使用默认的顺序测速以获得更具参考意义的结果";
|
|
||||||
else
|
|
||||||
msg = CliOpt_InEnglish ? "Measuring speed in sequence" : "顺序测速中";
|
|
||||||
|
|
||||||
xy_log_brkt (App_Name, bdpurple (CliOpt_InEnglish ? "MEASURE" : "测速"), msg);
|
xy_log_brkt (App_Name, bdpurple (CliOpt_InEnglish ? "MEASURE" : "测速"), msg);
|
||||||
say ("");
|
say ("");
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
* | Terrasse <terrasse@qq.com>
|
* | Terrasse <terrasse@qq.com>
|
||||||
* |
|
* |
|
||||||
* Created On : <2023-08-28>
|
* Created On : <2023-08-28>
|
||||||
* Last Modified : <2024-09-23>
|
* Last Modified : <2024-09-29>
|
||||||
*
|
*
|
||||||
* chsrc: Change Source —— 全平台通用命令行换源工具
|
* chsrc: Change Source —— 全平台通用命令行换源工具
|
||||||
* ------------------------------------------------------------*/
|
* ------------------------------------------------------------*/
|
||||||
|
|
||||||
#define Chsrc_Version "0.1.9.Beta1Dev2"
|
#define Chsrc_Version "0.1.9.Beta1Dev2"
|
||||||
#define Chsrc_Release_Date "2024/09/23"
|
#define Chsrc_Release_Date "2024/09/29"
|
||||||
#define Chsrc_Banner_Version "v" Chsrc_Version "-" Chsrc_Release_Date
|
#define Chsrc_Banner_Version "v" Chsrc_Version "-" Chsrc_Release_Date
|
||||||
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
|
#define Chsrc_Maintain_URL "https://github.com/RubyMetric/chsrc"
|
||||||
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
|
#define Chsrc_Maintain_URL2 "https://gitee.com/RubyMetric/chsrc"
|
||||||
@ -139,7 +139,6 @@ Chsrc_Usage[] = {
|
|||||||
|
|
||||||
"选项:",
|
"选项:",
|
||||||
"-dry Dry Run,模拟换源过程,命令仅打印并不运行",
|
"-dry Dry Run,模拟换源过程,命令仅打印并不运行",
|
||||||
"-para(llel) 并行测速 (默认的顺序测速更有参考意义)",
|
|
||||||
"-local 仅对本项目而非全局换源 (通过ls <target>查看支持情况)",
|
"-local 仅对本项目而非全局换源 (通过ls <target>查看支持情况)",
|
||||||
"-ipv6 使用IPv6测速",
|
"-ipv6 使用IPv6测速",
|
||||||
"-en(glish) 使用英文输出",
|
"-en(glish) 使用英文输出",
|
||||||
@ -173,7 +172,6 @@ Chsrc_Usage_English[] = {
|
|||||||
|
|
||||||
"Options:",
|
"Options:",
|
||||||
"-dry Dry Run. Simulate the source changing process, command only prints, not run",
|
"-dry Dry Run. Simulate the source changing process, command only prints, not run",
|
||||||
"-para(llel) Measure velocity in parallel",
|
|
||||||
"-local Change source only for this project rather than globally (Via `ls <target>`)",
|
"-local Change source only for this project rather than globally (Via `ls <target>`)",
|
||||||
"-ipv6 Speed measurement using IPv6",
|
"-ipv6 Speed measurement using IPv6",
|
||||||
"-en(glish) Output in English",
|
"-en(glish) Output in English",
|
||||||
@ -620,12 +618,6 @@ main (int argc, char const *argv[])
|
|||||||
{
|
{
|
||||||
CliOpt_DryRun = true;
|
CliOpt_DryRun = true;
|
||||||
}
|
}
|
||||||
else if ( xy_streql (argv[i], "-para")
|
|
||||||
|| xy_streql (argv[i], "-parallel")
|
|
||||||
|| xy_streql (argv[i], "-paralel"))
|
|
||||||
{
|
|
||||||
CliOpt_Parallel = true;
|
|
||||||
}
|
|
||||||
else if (xy_streql (argv[i], "-no-color") || xy_streql (argv[i], "-no-colour"))
|
else if (xy_streql (argv[i], "-no-color") || xy_streql (argv[i], "-no-colour"))
|
||||||
{
|
{
|
||||||
CliOpt_NoColor = true;
|
CliOpt_NoColor = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user