mirror of
https://github.com/RubyMetric/chsrc.git
synced 2024-11-25 09:00:41 +08:00
Use standard mark
This commit is contained in:
parent
e18f8bf4fc
commit
26274ed907
|
@ -8,7 +8,7 @@
|
|||
* Contributors : Peng Gao <gn3po4g@outlook.com>
|
||||
* |
|
||||
* Created on : <2023-08-29>
|
||||
* Last modified : <2024-08-16>
|
||||
* Last modified : <2024-08-17>
|
||||
*
|
||||
* chsrc 头文件
|
||||
* ------------------------------------------------------------*/
|
||||
|
@ -54,6 +54,9 @@ chsrc_note2 (const char* str)
|
|||
xy_log_brkt (to_yellow (App_Name), to_boldyellow ("提示"), to_yellow (str));
|
||||
}
|
||||
|
||||
#define YesMark "✓"
|
||||
#define NoMark "x"
|
||||
#define SemiYesMark "⍻"
|
||||
|
||||
void
|
||||
chsrc_log_check_result (const char *check_what, const char *check_type, bool exist)
|
||||
|
@ -61,12 +64,12 @@ chsrc_log_check_result (const char *check_what, const char *check_type, bool exi
|
|||
if (!exist)
|
||||
{
|
||||
xy_log_brkt (App_Name, to_boldred ("检查"), xy_strjoin (5,
|
||||
to_red ("x "), check_type, " ", to_red (check_what), " 不存在"));
|
||||
to_red (NoMark " "), check_type, " ", to_red (check_what), " 不存在"));
|
||||
}
|
||||
else
|
||||
{
|
||||
xy_log_brkt (App_Name, to_boldgreen ("检查"), xy_strjoin (5,
|
||||
to_green ("√ "), check_type, " ", to_green (check_what), " 存在"));
|
||||
to_green (YesMark " "), check_type, " ", to_green (check_what), " 存在"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,13 +79,13 @@ chsrc_log_cmd_result (bool result, int ret_code)
|
|||
{
|
||||
if (result)
|
||||
{
|
||||
xy_log_brkt (to_green (App_Name), to_boldgreen ("运行"), to_green ("√ 命令执行成功"));
|
||||
xy_log_brkt (to_green (App_Name), to_boldgreen ("运行"), to_green (YesMark " 命令执行成功"));
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[8] = {0};
|
||||
sprintf (buf, "%d", ret_code);
|
||||
char *log = xy_2strjoin (to_red ("x 命令执行失败,返回码 "), to_boldred (buf));
|
||||
char *log = xy_2strjoin (to_red (NoMark " 命令执行失败,返回码 "), to_boldred (buf));
|
||||
xy_log_brkt (to_red (App_Name), to_boldred ("运行"), log);
|
||||
}
|
||||
}
|
||||
|
|
37
src/chsrc.c
37
src/chsrc.c
|
@ -219,32 +219,33 @@ cli_print_target_features (FeatInfo f, const char *input_target_name)
|
|||
printf (to_boldpurple("\nFeatures:\n\n"));
|
||||
|
||||
char *get_msg = xy_2strjoin (" Get: 查看当前源状态 | chsrc get ", input_target_name);
|
||||
if (f.can_get) printf (" %s%s\n", to_boldgreen("✔"), to_purple(get_msg));
|
||||
else printf (" %s%s\n", to_boldred("x"), get_msg);puts("");
|
||||
if (f.can_get) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(get_msg));
|
||||
else printf (" %s%s\n", to_boldred(NoMark), get_msg);puts("");
|
||||
|
||||
char *reset_msg = xy_2strjoin (" Reset: 重置回默认源 | chsrc reset ", input_target_name);
|
||||
if (f.can_reset) printf (" %s%s\n", to_boldgreen("√"), to_purple(reset_msg));
|
||||
else printf (" %s%s\n", to_boldred("x"), reset_msg);puts("");
|
||||
if (f.can_reset) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(reset_msg));
|
||||
else printf (" %s%s\n", to_boldred(NoMark), reset_msg);puts("");
|
||||
|
||||
char *user_define_msg = xy_strjoin (4, " UserDefine: 用户自定义换源URL | chsrc set ", input_target_name, " https://user-define-url.org/", input_target_name);
|
||||
if (f.can_user_define) printf (" %s%s\n", to_boldgreen("✓"), to_purple(user_define_msg));
|
||||
else printf (" %s%s\n", to_boldred("x"), user_define_msg);puts("");
|
||||
if (f.can_user_define) printf (" %s%s\n", to_boldgreen(YesMark), to_purple(user_define_msg));
|
||||
else printf (" %s%s\n", to_boldred(NoMark), user_define_msg);puts("");
|
||||
|
||||
|
||||
char *locally_msg = xy_2strjoin (" Locally: 仅对本项目换源 | chsrc set -local ", input_target_name);
|
||||
|
||||
switch (f.stcan_locally) {
|
||||
case CanNotFully:
|
||||
printf (" %s%s\n", to_boldred(NoMark), locally_msg);puts("");
|
||||
break;
|
||||
case CanFully:
|
||||
printf (" %s%s\n", to_boldgreen(YesMark), to_purple(locally_msg));puts("");
|
||||
break;
|
||||
case CanSemi:
|
||||
printf (" %s%s\n\n %s\n", to_boldgreen(SemiYesMark), to_purple(locally_msg), f.locally);puts("");
|
||||
break;
|
||||
default:
|
||||
xy_unreach;
|
||||
switch (f.stcan_locally)
|
||||
{
|
||||
case CanNotFully:
|
||||
printf (" %s%s\n", to_boldred(NoMark), locally_msg);puts("");
|
||||
break;
|
||||
case CanFully:
|
||||
printf (" %s%s\n", to_boldgreen(YesMark), to_purple(locally_msg));puts("");
|
||||
break;
|
||||
case CanSemi:
|
||||
printf (" %s%s\n\n %s\n", to_boldgreen(SemiYesMark), to_purple(locally_msg), f.locally);puts("");
|
||||
break;
|
||||
default:
|
||||
xy_unreach;
|
||||
}
|
||||
|
||||
char *english_msg = xy_2strjoin (" English: 英文输出 | chsrc set -en ", input_target_name);
|
||||
|
|
Loading…
Reference in New Issue
Block a user