Add Dry Run mode

This commit is contained in:
Aoran Zeng
2024-08-09 01:46:58 +08:00
parent a8e8b2481c
commit d310dce76e
2 changed files with 52 additions and 34 deletions

View File

@@ -11,7 +11,7 @@
* | BlockLune <blocklune@gmail.com>
* |
* Created on : <2023-08-28>
* Last modified : <2024-08-08>
* Last modified : <2024-08-09>
*
* chsrc: Change Source —— 全平台通用命令行换源工具
* ------------------------------------------------------------*/
@@ -2410,6 +2410,7 @@ Chsrc_Usage[] = {
"reset <target> 重置,使用上游默认使用的源\n",
"选项:",
"-dry Dry Run模拟换源过程命令仅打印并不运行",
"-ipv6 使用IPv6测速",
"-local 仅对某项目而非全局换源 (通过issue命令查看支持情况)"
};
@@ -2699,6 +2700,11 @@ main (int argc, char const *argv[])
{
Cli_Option_InEnglish = true;
}
else if (xy_streql (argv[i], "-dry"))
{
CliOpt_DryRun = true;
chsrc_log (to_boldyellow ("**开启Dry Run模式模拟换源过程(跳过测速),命令仅打印并不运行**\n"));
}
else
{
chsrc_error (xy_2strjoin ("未识别的命令行选项 ", argv[i])); return 1;