Fix group target

This commit is contained in:
Aoran Zeng 2025-08-10 20:14:30 +08:00
parent 827a26951b
commit 915dbe1477
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
12 changed files with 37 additions and 31 deletions

View File

@ -44,9 +44,25 @@ chef_allow_local_mode (Target_t *target, Capability_t cap, const char *explain_z
return;
target->cap_local = cap;
if (cap == FullyCan)
{
target->cap_local_explain = xy_strdup (CHINESE ? "完全支持项目级换源" : "Supports project-level source switching");
return;
}
target->cap_local_explain = xy_strdup (CHINESE ? explain_zh : explain_en);
}
chef_forbid_local_mode (Target_t *target)
{
if (!target)
return;
target->cap_local = CanNot;
target->cap_local_explain = xy_strdup (CHINESE ? "无法进行项目级换源" : "Unable to perform project-level source switching");
}
void
chef_allow_user_define (Target_t *target)

View File

@ -50,7 +50,7 @@ void
pl_js_bun_setsrc (char *option)
{
// 用的是 npm Registry 的源
chsrc_yield_source (pl_js_group);
Source_t source = chsrc_yield_source_and_confirm (pl_js_group_target, option);
char *content = RAWSTR_pl_js_bun_config;

View File

@ -58,9 +58,9 @@ pl_js_yarn_getsrc (char *option)
void
pl_js_yarn_setsrc (char *option)
{
chsrc_yield_source (pl_js_group);
Source_t source = chsrc_yield_source (pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *cmd = NULL;

View File

@ -15,6 +15,7 @@ void
pl_js_group_prelude (void)
{
use_this(pl_js_group);
chef_allow_gsr(pl_js_group);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
@ -25,10 +26,6 @@ pl_js_group_prelude (void)
chef_set_sous_chefs (this, 0);
chef_set_contributors (this,0);
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, PartiallyCan,
"支持 npm, yarn v2, pnpm, 不支持 yarn v1"
"Support npm, yarn v2, pnpm, not yarn v1");
@ -54,6 +51,7 @@ void
pl_js_nodejs_binary_prelude (void)
{
use_this(pl_js_nodejs_binary);
chef_allow_gsr(pl_js_group);
chef_set_created_on (this, "2023-09-09");
chef_set_last_updated (this, "2025-07-11");
@ -64,10 +62,6 @@ pl_js_nodejs_binary_prelude (void)
chef_set_sous_chefs (this, 0);
chef_set_contributors (this, 0);
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_forbid_local_mode (this);
chef_allow_english(this);
chef_allow_user_define(this);

View File

@ -43,9 +43,9 @@ pl_js_npm_getsrc (char *option)
void
pl_js_npm_setsrc (char *option)
{
chsrc_yield_source (pl_js_group);
Source_t source = chsrc_yield_source (pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *cmd = NULL;

View File

@ -43,9 +43,9 @@ pl_js_pnpm_getsrc (char *option)
void
pl_js_pnpm_setsrc (char *option)
{
chsrc_yield_source (pl_js_group);
Source_t source = chsrc_yield_source (pl_js_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *cmd = NULL;

View File

@ -45,9 +45,9 @@ pl_python_pdm_getsrc (char *option)
void
pl_python_pdm_setsrc (char *option)
{
chsrc_yield_source (pl_python_group);
Source_t source = chsrc_yield_source (pl_python_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *cmd = NULL;

View File

@ -41,9 +41,9 @@ pl_python_poetry_getsrc (char *option)
void
pl_python_poetry_setsrc (char *option)
{
chsrc_yield_source (pl_python_group);
Source_t source = chsrc_yield_source (pl_python_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *cmd = NULL;

View File

@ -57,7 +57,7 @@ void
pl_python_rye_setsrc (char *option)
{
/* 并不在 Python group 中,所以不考虑 target group 情况,仅使用 Python group 提供的源 */
chsrc_yield_source_and_confirm (pl_python_group);
Source_t source = chsrc_yield_source_and_confirm (pl_python_group_target, option);
const char *content = RAWSTR_pl_python_rye_config;

View File

@ -23,6 +23,7 @@ void
pl_python_group_prelude (void)
{
use_this(pl_python_group);
chef_allow_gsr(pl_python_group);
chef_set_created_on (this, "2023-09-03");
chef_set_last_updated (this, "2025-07-14");
@ -35,9 +36,6 @@ pl_python_group_prelude (void)
"yongxiang", "1926885268@qq.com",
"happy game", "happygame1024@gmail.com");
chef_allow_get();
chef_allow_set();
chef_allow_reset();
chef_allow_local_mode (this, PartiallyCan, "部分包管理器支持项目级换源", "Some package managers support project-level source changing");
chef_allow_english(this);

View File

@ -55,9 +55,9 @@ pl_python_pip_setsrc (char *option)
return;
}
chsrc_yield_source (pl_python_group);
Source_t source = chsrc_yield_source (pl_python_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *py_prog_name = NULL;
pl_python_get_py_program_name (&py_prog_name);

View File

@ -21,18 +21,16 @@ pl_python_uv_prelude (void)
"ccy", "icuichengyi@gmail.com",
"Aoran Zeng", "ccmywish@qq.com");
chef_allow_local_mode (this, FullyCan, "支持项目级配置", "Supports project-level configuration");
chef_allow_local_mode (this, FullyCan, NULL, NULL);
chef_allow_english(this);
chef_allow_user_define(this);
chef_set_note ("uv的配置优先级顺序: $workspaces/uv.toml > $workspaces/pyproject.toml > ~/.config/uv/uv.toml > /etc/uv/uv.toml",
"uv config priority order: $workspaces/uv.toml > $workspaces/pyproject.toml > ~/.config/uv/uv.toml > /etc/uv/uv.toml");
// 使用 pl_python_group 的源
this->sources = pl_python_group_target.sources;
this->sources_n = pl_python_group_target.sources_n;
}
/**
* chsrc get uv
*
@ -113,9 +111,9 @@ pl_python_uv_setsrc (char *option)
{
chsrc_ensure_program ("uv");
chsrc_yield_source (pl_python_group);
Source_t source = chsrc_yield_source (pl_python_group_target, option);
if (chsrc_in_standalone_mode())
chsrc_confirm_source();
chsrc_confirm_source(&source);
char *uv_config = pl_python_find_uv_config (true);
if (NULL==uv_config)