重命名 sub_targets 为 sub_dishes

This commit is contained in:
Aoran Zeng committed 2026-08-14 11:36:01 +08:00
1 parent 03e90cd249
commit 1e29d49fe4
8 files changed
+33 -33

No files matched your search

+23 -23
View File
@@ -674,23 +674,23 @@ chefs_handle_List_Info (Target_t *target, const char *input, char *option)
/* group target 仅展示维护信息 */
if (dish_has_sub_dishes(target))
{
int sub_count = xy_seq_len (target->sub_targets);
int sub_count = xy_seq_len (target->sub_dishes);
char *zh_msg = xy_strcat (3,
bdyellow(xy_strcat (4, input, " 由以下", xy_int2str(sub_count), "个子目标组成,可使用 chsrc ls <")),
bdpurple("sub-target"),
bdpurple("sub-dish"),
bdyellow("> 分别查看\n"));
char *en_msg = xy_strcat (3,
bdyellow(xy_strcat (4, input, " consists of the following ", xy_int2str(sub_count), " sub targets, you can use `chsrc ls <")),
bdpurple("sub-target"),
bdyellow(xy_strcat (4, input, " consists of the following ", xy_int2str(sub_count), " sub dishes, you can use `chsrc ls <")),
bdpurple("sub-dish"),
bdyellow("> to view each\n"));
chsrc_log (CHINESE ? zh_msg : en_msg);
for (size_t i=0; i<sub_count; i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
sub_target->preparefn();
println (bdpurple (sub_target->aliases));
/* 嵌套的 group target 的处理 */
@@ -746,23 +746,23 @@ chefs_handle_Measure_Source (Target_t *target, const char *input, char *option)
/* group target 不测速,让用户自己分别测速 */
if (dish_has_sub_dishes(target))
{
int sub_count = xy_seq_len (target->sub_targets);
int sub_count = xy_seq_len (target->sub_dishes);
char *zh_msg = xy_strcat (3,
bdyellow(xy_strcat (4, input, " 由以下", xy_int2str(sub_count), "个子目标组成,可使用 chsrc measure <")),
bdpurple("sub-target"),
bdpurple("sub-dish"),
bdyellow("> 分别测速"));
char *en_msg = xy_strcat (3,
bdyellow(xy_strcat (4, input, " consists of the following ", xy_int2str(sub_count), " sub targets, you can use `chsrc measure <")),
bdpurple("sub-target"),
bdyellow(xy_strcat (4, input, " consists of the following ", xy_int2str(sub_count), " sub dishes, you can use `chsrc measure <")),
bdpurple("sub-dish"),
bdyellow("> to measure each"));
chsrc_log (CHINESE ? zh_msg : en_msg);
for (size_t i=0; i<sub_count; i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
sub_target->preparefn();
println (bdpurple (sub_target->aliases));
}
@@ -783,9 +783,9 @@ chefs_handle_Get_Source (Target_t *target, const char *input, char *option)
{
if (dish_has_sub_dishes(target))
{
for (size_t i=0; i<xy_seq_len(target->sub_targets); i++)
for (size_t i=0; i<xy_seq_len(target->sub_dishes); i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
sub_target->preparefn();
println (bdpurple(sub_target->aliases));
chsrc_set_target_group_mode();
@@ -814,9 +814,9 @@ chefs_handle_Set_Source (Target_t *target, const char *input, char *option)
{
if (dish_has_sub_dishes(target))
{
for (size_t i=0; i<xy_seq_len(target->sub_targets); i++)
for (size_t i=0; i<xy_seq_len(target->sub_dishes); i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
sub_target->preparefn();
println (bdpurple(sub_target->aliases));
chefs_handle_Set_Source (sub_target, dish_get_first_alias(sub_target), option);
@@ -837,7 +837,7 @@ chefs_handle_Set_Source (Target_t *target, const char *input, char *option)
*/
if (dish_has_sub_dishes(target))
{
/* group target 不要检查,留给后续 sub targets 检查 */
/* group target 不要检查,留给后续 sub dishes 检查 */
xy_noop();
}
else
@@ -862,9 +862,9 @@ chefs_handle_Reset_Source (Target_t *target, const char *input, char *option)
{
if (dish_has_sub_dishes(target))
{
for (size_t i=0; i<xy_seq_len(target->sub_targets); i++)
for (size_t i=0; i<xy_seq_len(target->sub_dishes); i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
sub_target->preparefn();
println (bdpurple(sub_target->aliases));
chefs_handle_Reset_Source (sub_target, dish_get_first_alias(sub_target), option);
@@ -898,13 +898,13 @@ chefs_handle_user_command (Target_t *target, TargetCmd code, const char *input,
{
if (dish_has_sub_dishes(target))
{
int sub_count = xy_seq_len(target->sub_targets);
int sub_count = xy_seq_len(target->sub_dishes);
char *zh_msg = bdyellow(xy_strcat (4, input, " 由", xy_int2str(sub_count), "个子目标组成: "));
char *en_msg = bdyellow(xy_strcat (4, input, " consists of ", xy_int2str(sub_count), " sub targets\n"));
char *en_msg = bdyellow(xy_strcat (4, input, " consists of ", xy_int2str(sub_count), " sub dishes\n"));
for (size_t i=0; i<sub_count; i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
zh_msg = xy_strcat (3, zh_msg, bdpurple(dish_get_first_alias(sub_target)),
(i < sub_count-1) ? ", " : "");
}
@@ -940,10 +940,10 @@ chefs_handle_user_command (Target_t *target, TargetCmd code, const char *input,
{
if (dish_has_sub_dishes(target))
{
for (size_t i=0; i<xy_seq_len(target->sub_targets); i++)
for (size_t i=0; i<xy_seq_len(target->sub_dishes); i++)
{
Target_t *sub_target = xy_seq_at (target->sub_targets, i);
/* 递归显示 sub targets 信息 */
Target_t *sub_target = xy_seq_at (target->sub_dishes, i);
/* 递归显示 sub dishes 信息 */
sub_target->preparefn();
cli_print_target_maintain_info_briefly (sub_target, sub_target->aliases);
// chefs_handle_user_command (sub_target, code, input, option);
+4 -4
View File
@@ -473,15 +473,15 @@ chef_set_sauciers (Target_t *target, uint32_t count, ...)
void
chef_set_sub_targets (Target_t *target, uint32_t count, ...)
chef_set_sub_dishes (Target_t *target, uint32_t count, ...)
{
xy_cant_be_null (target);
target->sub_targets = xy_seq_new ();
target->sub_dishes = xy_seq_new ();
if (count < 1)
{
chsrc_breakdown ("group target 必须至少有一个 sub target");
chsrc_breakdown ("group target 必须至少有一个 sub dish");
}
va_list args;
@@ -490,7 +490,7 @@ chef_set_sub_targets (Target_t *target, uint32_t count, ...)
for (uint32_t i = 0; i < count; i++)
{
Target_t *sub_target = va_arg (args, Target_t*);
xy_seq_push (target->sub_targets, sub_target);
xy_seq_push (target->sub_dishes, sub_target);
}
va_end (args);
}
+1 -1
View File
@@ -1061,7 +1061,7 @@ chsrc_yield_source (Target_t *t, char *option)
* 防止某些意外时刻 _setsrc() 等函数会被直接调,但此时 _prepare() 还没有执行过
* 我们在这里卡一道,确保 _prepare() 被调用
*
* 目前可能出现这种情况的时候:组换源的时候,sub targets 的 _setsrc() 被直接调用
* 目前可能出现这种情况的时候:组换源的时候,sub dishes 的 _setsrc() 被直接调用
*/
if (!t->inited) t->preparefn();
+1 -1
View File
@@ -33,5 +33,5 @@ dish_get_first_alias (Target_t *target)
bool
dish_has_sub_dishes (Target_t *target)
{
return (target->sub_targets && xy_seq_len(target->sub_targets) > 1);
return (target->sub_dishes && xy_seq_len(target->sub_dishes) > 1);
}
+1 -1
View File
@@ -188,7 +188,7 @@ typedef struct Target_t
void (*preparefn) (void);
bool inited; /* 是否执行过了 preparefn() */
XySeq_t *sub_targets; /* 某些 target 为 group target,几乎完全由 sub targets 定义 */
XySeq_t *sub_dishes; /* 某些 target 为 group target,几乎完全由 sub dishes 定义 */
Source_t *sources;
int sources_n;
+1 -1
View File
@@ -12,5 +12,5 @@ pl_js_group_prepare (void)
chef_set_recipe_created_on (this, "2023-09-09");
chef_set_recipe_last_updated (this, "2026-08-13");
chef_set_sub_targets (this, 3, &pl_npm_target, &pl_yarn_target, &pl_pnpm_target);
chef_set_sub_dishes (this, 3, &pl_npm_target, &pl_yarn_target, &pl_pnpm_target);
}
+1 -1
View File
@@ -12,5 +12,5 @@ pl_py_group_prepare (void)
chef_set_recipe_created_on (this, "2023-09-03");
chef_set_recipe_last_updated (this, "2026-08-13");
chef_set_sub_targets (this, 4, &pl_pip_target, &pl_pdm_target, &pl_poetry_target, &pl_uv_target);
chef_set_sub_dishes (this, 4, &pl_pip_target, &pl_pdm_target, &pl_poetry_target, &pl_uv_target);
}
+1 -1
View File
@@ -12,7 +12,7 @@ pl_uv_prepare (void)
chef_set_recipe_created_on (this, "2026-08-12");
chef_set_recipe_last_updated (this, "2026-08-13");
chef_set_sub_targets (this, 2, &pl_uv_pypi_index_target, &pl_uv_python_build_target);
chef_set_sub_dishes (this, 2, &pl_uv_pypi_index_target, &pl_uv_python_build_target);
chef_use_other_target_sources (this, &pl_pypi_target);
}