内部使用新的状态变量判断scope

This commit is contained in:
Aoran Zeng
2026-02-22 21:43:46 +08:00
parent 708092aab2
commit 0b5efcb77d
13 changed files with 20 additions and 24 deletions

View File

@@ -38,7 +38,7 @@ pl_clojure_setsrc (char *option)
{
chsrc_use_this_source (pl_clojure);
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
chsrc_note2 ("请在项目根目录中的 project.clj 中手动添加 :mirrors 关键字:");
char *config = xy_str_gsub (RAWSTR_pl_clojure_project_clj, "@url@", source.url);

View File

@@ -51,7 +51,7 @@ pl_js_bun_setsrc (char *option)
content = xy_str_gsub (content, "@url@", source.url);
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
chsrc_note2 ("请手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
}

View File

@@ -62,7 +62,7 @@ pl_js_yarn_setsrc (char *option)
// 从 Yarn V2 开始,使用新的配置名
if (pl_js_yarn_get_yarn_version () >= 2)
{
if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源
if (chsrc_in_project_scope_mode()) // Yarn 默认情况下就是基于本项目换源
cmd = xy_2strcat ("yarn config set npmRegistryServer ", source.url);
else
cmd = xy_2strcat ("yarn config set npmRegistryServer --home ", source.url);
@@ -71,7 +71,7 @@ pl_js_yarn_setsrc (char *option)
}
else
{
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
char *msg = ENGLISH ? "Yarn v1 doesn't support `-local`. SKIP changing source!" : "Yarn v1 不支持 -local跳过换源";
chsrc_error (msg);

View File

@@ -44,7 +44,7 @@ pl_js_npm_setsrc (char *option)
char *cmd = NULL;
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
cmd = xy_2strcat ("npm config --location project set registry ", source.url);
else
cmd = xy_2strcat ("npm config set registry ", source.url);

View File

@@ -45,7 +45,7 @@ pl_js_pnpm_setsrc (char *option)
char *cmd = NULL;
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
cmd = xy_2strcat ("pnpm config --location project set registry ", source.url);
else
cmd = xy_2strcat ("pnpm config -g set registry ", source.url);

View File

@@ -58,7 +58,7 @@ pl_php_setsrc (char *option)
chsrc_use_this_source (pl_php);
char *where = " -g ";
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
where = " ";
}

View File

@@ -47,7 +47,7 @@ pl_python_pdm_setsrc (char *option)
char *cmd = NULL;
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
cmd = xy_2strcat ("pdm config --local pypi.url ", source.url);
else
cmd = xy_2strcat ("pdm config --global pypi.url ", source.url);

View File

@@ -43,7 +43,7 @@ pl_python_poetry_setsrc (char *option)
char *cmd = NULL;
if (!chsrc_in_local_mode())
if (!chsrc_in_project_scope_mode())
chsrc_alert2 ("Poetry 仅支持项目级换源");
cmd = xy_2strcat ("poetry source add my_mirror ", source.url);

View File

@@ -60,7 +60,7 @@ void
pl_python_pip_setsrc (char *option)
{
// 对于不支持的情况,尽早结束
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
char *msg = ENGLISH ? "pip doesn't support `-local`. SKIP changing source!" : "pip 不支持 -local跳过换源";
chsrc_error (msg);

View File

@@ -43,7 +43,7 @@ pl_python_uv_prelude (void)
char *
pl_python_find_uv_config (bool mkdir)
{
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
return xy_2strcat (PL_Python_uv_Local_ConfigPath, PL_Python_uv_ConfigFile);
}

View File

@@ -88,7 +88,7 @@ pl_ruby_setsrc (char *option)
chsrc_ensure_program ("bundle");
char *where = " --global ";
if (chsrc_in_local_mode())
if (chsrc_in_project_scope_mode())
{
where = " --local ";
}