mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-01-22 16:47:47 +08:00
Change color name
This commit is contained in:
parent
835e2cd056
commit
94b3c15781
|
@ -7,7 +7,7 @@
|
|||
* Contributors : Peng Gao <gn3po4g@outlook.com>
|
||||
* |
|
||||
* Created on : <2023-08-29>
|
||||
* Last modified : <2024-08-18>
|
||||
* Last modified : <2024-08-22>
|
||||
*
|
||||
* chsrc 头文件
|
||||
* ------------------------------------------------------------*/
|
||||
|
@ -58,22 +58,22 @@ bool CliOpt_DryRun = false;
|
|||
#define chsrc_warn2(str) xy_warn_brkt(App_Name,"警告",str)
|
||||
#define chsrc_error2(str) xy_error_brkt(App_Name,"错误",str)
|
||||
|
||||
#define red(str) xy_str_to_red(str)
|
||||
#define blue(str) xy_str_to_blue(str)
|
||||
#define green(str) xy_str_to_green(str)
|
||||
#define yellow(str) xy_str_to_yellow(str)
|
||||
#define purple(str) xy_str_to_purple(str)
|
||||
#define bold(str) xy_str_to_bold(str)
|
||||
#define bred(str) xy_str_to_bold(xy_str_to_red(str))
|
||||
#define bblue(str) xy_str_to_bold(xy_str_to_blue(str))
|
||||
#define bgreen(str) xy_str_to_bold(xy_str_to_green(str))
|
||||
#define byellow(str) xy_str_to_bold(xy_str_to_yellow(str))
|
||||
#define bpurple(str) xy_str_to_bold(xy_str_to_purple(str))
|
||||
#define red(str) xy_str_to_red(str)
|
||||
#define blue(str) xy_str_to_blue(str)
|
||||
#define green(str) xy_str_to_green(str)
|
||||
#define yellow(str) xy_str_to_yellow(str)
|
||||
#define purple(str) xy_str_to_purple(str)
|
||||
#define bold(str) xy_str_to_bold(str)
|
||||
#define bdred(str) xy_str_to_bold(xy_str_to_red(str))
|
||||
#define bdblue(str) xy_str_to_bold(xy_str_to_blue(str))
|
||||
#define bdgreen(str) xy_str_to_bold(xy_str_to_green(str))
|
||||
#define bdyellow(str) xy_str_to_bold(xy_str_to_yellow(str))
|
||||
#define bdpurple(str) xy_str_to_bold(xy_str_to_purple(str))
|
||||
|
||||
void
|
||||
chsrc_note2 (const char* str)
|
||||
{
|
||||
xy_log_brkt (yellow (App_Name), byellow ("提示"), yellow (str));
|
||||
xy_log_brkt (yellow (App_Name), bdyellow ("提示"), yellow (str));
|
||||
}
|
||||
|
||||
#define YesMark "✓"
|
||||
|
@ -106,12 +106,12 @@ log_check_result (const char *check_what, const char *check_type, bool exist)
|
|||
|
||||
if (!exist)
|
||||
{
|
||||
xy_log_brkt (App_Name, bred (chk_msg), xy_strjoin (5,
|
||||
xy_log_brkt (App_Name, bdred (chk_msg), xy_strjoin (5,
|
||||
red (NoMark " "), check_type, " ", red (check_what), not_exist_msg));
|
||||
}
|
||||
else
|
||||
{
|
||||
xy_log_brkt (App_Name, bgreen (chk_msg), xy_strjoin (5,
|
||||
xy_log_brkt (App_Name, bdgreen (chk_msg), xy_strjoin (5,
|
||||
green (YesMark " "), check_type, " ", green (check_what), exist_msg));
|
||||
}
|
||||
}
|
||||
|
@ -141,13 +141,13 @@ log_cmd_result (bool result, int ret_code)
|
|||
}
|
||||
|
||||
if (result)
|
||||
xy_log_brkt (green (App_Name), bgreen (run_msg), green (succ_msg));
|
||||
xy_log_brkt (green (App_Name), bdgreen (run_msg), green (succ_msg));
|
||||
else
|
||||
{
|
||||
char buf[8] = {0};
|
||||
sprintf (buf, "%d", ret_code);
|
||||
char *log = xy_2strjoin (red (fail_msg), bred (buf));
|
||||
xy_log_brkt (red (App_Name), bred (run_msg), log);
|
||||
char *log = xy_2strjoin (red (fail_msg), bdred (buf));
|
||||
xy_log_brkt (red (App_Name), bdred (run_msg), log);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -767,9 +767,9 @@ static void
|
|||
chsrc_run (const char *cmd, int run_option)
|
||||
{
|
||||
if (CliOpt_InEnglish)
|
||||
xy_log_brkt (blue (App_Name), bblue ("RUN"), blue (cmd));
|
||||
xy_log_brkt (blue (App_Name), bdblue ("RUN"), blue (cmd));
|
||||
else
|
||||
xy_log_brkt (blue (App_Name), bblue ("运行"), blue (cmd));
|
||||
xy_log_brkt (blue (App_Name), bdblue ("运行"), blue (cmd));
|
||||
|
||||
if (CliOpt_DryRun)
|
||||
{
|
||||
|
|
32
src/chsrc.c
32
src/chsrc.c
|
@ -222,19 +222,19 @@ cli_print_target_available_sources (SourceInfo sources[], size_t size)
|
|||
void
|
||||
cli_print_target_features (FeatInfo f, const char *input_target_name)
|
||||
{
|
||||
say (bpurple("\nFeatures:\n"));
|
||||
say (bdpurple("\nFeatures:\n"));
|
||||
|
||||
char *get_msg = xy_2strjoin (" Get: 查看当前源状态 | chsrc get ", input_target_name);
|
||||
if (f.can_get) printf (" %s%s\n", bgreen(YesMark), purple(get_msg));
|
||||
else printf (" %s%s\n", bred(NoMark), get_msg);br();
|
||||
if (f.can_get) printf (" %s%s\n", bdgreen(YesMark), purple(get_msg));
|
||||
else printf (" %s%s\n", bdred(NoMark), get_msg);br();
|
||||
|
||||
char *reset_msg = xy_2strjoin (" Reset: 重置回默认源 | chsrc reset ", input_target_name);
|
||||
if (f.can_reset) printf (" %s%s\n", bgreen(YesMark), purple(reset_msg));
|
||||
else printf (" %s%s\n", bred(NoMark), reset_msg);br();
|
||||
if (f.can_reset) printf (" %s%s\n", bdgreen(YesMark), purple(reset_msg));
|
||||
else printf (" %s%s\n", bdred(NoMark), reset_msg);br();
|
||||
|
||||
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", bgreen(YesMark), purple(user_define_msg));
|
||||
else printf (" %s%s\n", bred(NoMark), user_define_msg);br();
|
||||
if (f.can_user_define) printf (" %s%s\n", bdgreen(YesMark), purple(user_define_msg));
|
||||
else printf (" %s%s\n", bdred(NoMark), user_define_msg);br();
|
||||
|
||||
|
||||
char *locally_msg = xy_2strjoin (" Locally: 仅对本项目换源 | chsrc set -local ", input_target_name);
|
||||
|
@ -242,26 +242,26 @@ cli_print_target_features (FeatInfo f, const char *input_target_name)
|
|||
switch (f.stcan_locally)
|
||||
{
|
||||
case CanNotFully:
|
||||
printf (" %s%s\n", bred(NoMark), locally_msg);br();
|
||||
printf (" %s%s\n", bdred(NoMark), locally_msg);br();
|
||||
break;
|
||||
case CanFully:
|
||||
printf (" %s%s\n", bgreen(YesMark), purple(locally_msg));br();
|
||||
printf (" %s%s\n", bdgreen(YesMark), purple(locally_msg));br();
|
||||
break;
|
||||
case CanSemi:
|
||||
printf (" %s%s\n\n %s\n", bgreen(SemiYesMark), purple(locally_msg), f.locally);br();
|
||||
printf (" %s%s\n\n %s\n", bdgreen(SemiYesMark), purple(locally_msg), f.locally);br();
|
||||
break;
|
||||
default:
|
||||
xy_unreach;
|
||||
}
|
||||
|
||||
char *english_msg = xy_2strjoin (" English: 英文输出 | chsrc set -en ", input_target_name);
|
||||
// if (f.can_english) printf (" %s%s\n", bgreen(YesMark), purple(english_msg));
|
||||
// else printf (" %s%s\n", bred(NoMark), english_msg);
|
||||
// if (f.can_english) printf (" %s%s\n", bdgreen(YesMark), purple(english_msg));
|
||||
// else printf (" %s%s\n", bdred(NoMark), english_msg);
|
||||
|
||||
|
||||
if (f.note)
|
||||
{
|
||||
printf ("%s%s\n", byellow ("备注: "), byellow (f.note));
|
||||
printf ("%s%s\n", bdyellow ("备注: "), bdyellow (f.note));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,8 +406,8 @@ get_target (const char *input, TargetOp code, char *option)
|
|||
}
|
||||
else if (TargetOp_List_Config==code)
|
||||
{
|
||||
say (bblue(xy_strjoin (3, "指定使用某源,请使用 chsrc set ", input, " <code>\n")));
|
||||
say (bgreen("Available Sources: \n"));
|
||||
say (bdblue(xy_strjoin (3, "指定使用某源,请使用 chsrc set ", input, " <code>\n")));
|
||||
say (bdgreen("Available Sources: \n"));
|
||||
// chsrc_info (xy_strjoin (3, "下方 code 列,可用于指定使用某源,请使用 chsrc set ", input, " <code>\n"));
|
||||
printf (" %-14s%-35s%-43s ", "code", "镜像站简写", "换源URL"); say ("镜像站名称");
|
||||
say ("--------- -------------- ----------------------------------------------- ---------------------");
|
||||
|
@ -469,7 +469,7 @@ main (int argc, char const *argv[])
|
|||
else if (xy_streql (argv[i], "-dry"))
|
||||
{
|
||||
CliOpt_DryRun = true;
|
||||
chsrc_log (byellow ("**开启Dry Run模式,模拟换源过程(跳过测速),命令仅打印并不运行**\n"));
|
||||
chsrc_log (bdyellow ("**开启Dry Run模式,模拟换源过程(跳过测速),命令仅打印并不运行**\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user