31313232 * |
3333 * Created On : <2023-08-28>
34- * Last Modified : <2025-07-21 >
34+ * Last Modified : <2025-07-22 >
3535 *
3636 * chsrc: Change Source —— 全平台通用命令行换源工具
3737 * ------------------------------------------------------------*/
141141
142142
143143static const char *
144- Chsrc_Usage [] = {
145- "使用: chsrc <command> [options] [target] [mirror]" ,
146- "help 打印此帮助,或 h, -h, --help" ,
147- "issue 查看相关issue\n" ,
144+ USAGE_CHINESE =
145+ R "(名称:
146+ chsrc - Change Source - (GPLv3 + ) - Developed by RubyMetric
148147
149- "list (或 ls, 或 l) 列出可用镜像源,和可换源目标" ,
150- "list mirror/target 列出可用镜像源,或可换源目标" ,
151- "list os/lang/ware 列出可换源的操作系统/编程语言/软件\n" ,
148+ 版本 :
149+ @ver @
152150
153- "measure <target> 对该目标所有源测速" ,
154- "cesu <target> \n" ,
151+ 使用 :
152+ chsrc < command > [ options ] [ target ] [ mirror ]
155153
156- "list <target> 查看该目标可用源与支持功能" ,
157- "get <target> 查看该目标当前源的使用情况\n" ,
154+ 命令 :
155+ help , h 打印此帮助 ,或 - h , -- help
156+ issue 查看相关issue
158157
159- "set <target> 换源,自动测速后挑选最快源" ,
160- "set <target> first 换源,使用维护团队测速第一的源" ,
161- "set <target> <mirror> 换源,指定使用某镜像站 (通过list <target>查看)" ,
162- "set <target> https://url 换源,用户自定义源URL" ,
163- "reset <target> 重置,使用上游默认使用的源\n" ,
158+ list , ls , l 列出可用镜像站和可换源目标
159+ list mirror |target 列出支持的 : 镜像站 /换源目标
160+ list os |lang |ware 列出支持的 : 操作系统 /编程语言 /软件
161+ list < target > 查看该目标可用源与支持功能
164162
165- "选项:" ,
166- "-dry Dry Run,模拟换源过程,命令仅打印并不运行" ,
167- "-local 仅对本项目而非全局换源 (通过ls <target>查看支持情况)" ,
168- "-ipv6 使用IPv6测速" ,
169- "-en(glish) 使用英文输出" ,
170- "-no-color 无颜色输出\n" ,
163+ measure , m , cesu < target > 对该目标所有源测速
171164
172- "镜像站状态: <https://github.com/RubyMetric/chsrc/wiki>" ,
173- "维护: <" Chsrc_Maintain_URL ">\n" ,
165+ get , g < target > 查看该目标当前源的使用情况
166+
167+ set , s < target > 换源 ,自动测速后挑选最快源
168+ set < target > first 换源 ,使用维护团队测速第一的源
169+ set < target > < mirror > 换源 ,指定使用某镜像站 (通过list < target > 查看 )
170+ set < target > < URL > 换源 ,用户自定义源URL
171+ reset < target > 重置 ,使用上游默认使用的源
172+
173+ 选项 :
174+ - dry Dry Run ,模拟换源过程 ,命令仅打印并不运行
175+ - local 仅对本项目而非全局换源 (通过ls < target > 查看支持情况 )
176+ - ipv6 使用IPv6测速
177+ - en (glish ) 使用英文输出
178+ - no - color 无颜色输出
179+
180+ 维护 :
181+ 邀请您担任 Chef , 为用户把关您熟悉的 recipe
182+ 源代码地址 : < @url @>
183+ 成为维护者 : < https ://github.com/RubyMetric/chsrc/issues/130>
184+ )";
174185
175- "邀请您担任 Chef 或 Taster, 为用户把关您熟悉的秘制菜肴 (recipe): <https://github.com/RubyMetric/chsrc/issues/130>"
176- };
177186
178187static const char *
179188Chsrc_Usage_English [] = {
@@ -422,9 +431,7 @@ cli_print_version ()
422431void
423432cli_print_help ()
424433{
425- say (xy_strjoin (3 , "chsrc: Change Source (GPLv3+) " ,
426- purple ("v" Chsrc_Version "-" Chsrc_Release_Date ), " by RubyMetric" ));
427- br ();
434+ char * version_string = purple ("v" Chsrc_Version "-" Chsrc_Release_Date );
428435
429436 if (ENGLISH )
430437 {
@@ -433,8 +440,9 @@ cli_print_help ()
433440 }
434441 else
435442 {
436- for (int i = 0 ; i < xy_arylen (Chsrc_Usage ); i ++ )
437- say (Chsrc_Usage [i ]);
443+ char * str = xy_str_gsub (USAGE_CHINESE , "@ver@" , version_string );
444+ str = xy_str_gsub (str , "@url@" , Chsrc_Maintain_URL );
445+ println (str );
438446 }
439447}
440448
0 commit comments