mirror of
https://github.com/RubyMetric/chsrc
synced 2025-10-20 18:05:08 +08:00
Use new ProgMode
This commit is contained in:
@@ -33,7 +33,7 @@ pl_nodejs_bun_setsrc (char *option)
|
||||
char *file = xy_strjoin(3, "[install]\n"
|
||||
"registry = \"", source.url, "\"");
|
||||
|
||||
if (CliOpt_Locally==true)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
chsrc_note2 ("请您手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ pl_nodejs_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
|
||||
|
||||
if (!*npm_exist && !*yarn_exist && !*pnpm_exist)
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "No npm, yarn or pnpm command found, check if at least one is present"
|
||||
char *msg = ENGLISH ? "No npm, yarn or pnpm command found, check if at least one is present"
|
||||
: "未找到 npm 或 yarn 或 pnpm 命令,请检查是否存在其一";
|
||||
chsrc_error (msg);
|
||||
exit (Exit_UserCause);
|
||||
@@ -64,7 +64,7 @@ void
|
||||
pl_nodejs_setsrc (char *option)
|
||||
{
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "Three package managers will be replaced for you at the same time: " \
|
||||
char *msg = ENGLISH ? "Three package managers will be replaced for you at the same time: " \
|
||||
"npm, pnpm, yarn. If you need to change the source independently, " \
|
||||
"please run independently `chsrc set <pkg-manager>`"
|
||||
: "将同时为您更换3个包管理器 npm, pnpm, Yarn 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>";
|
||||
|
@@ -50,7 +50,7 @@ pl_nodejs_yarn_setsrc (char *option)
|
||||
// 从 Yarn V2 开始,使用新的配置名
|
||||
if (pl_nodejs_yarn_get_yarn_version () >= 2)
|
||||
{
|
||||
if (CliOpt_Locally==true) // Yarn 默认情况下就是基于本项目换源
|
||||
if (chsrc_in_local_mode()) // Yarn 默认情况下就是基于本项目换源
|
||||
cmd = xy_2strjoin ("yarn config set npmRegistryServer ", source.url);
|
||||
else
|
||||
cmd = xy_2strjoin ("yarn config set npmRegistryServer --home ", source.url);
|
||||
@@ -59,9 +59,9 @@ pl_nodejs_yarn_setsrc (char *option)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CliOpt_Locally)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "Yarn v1 doesn't support `-local`. SKIP changing source!" : "Yarn v1 不支持 -local,跳过换源";
|
||||
char *msg = ENGLISH ? "Yarn v1 doesn't support `-local`. SKIP changing source!" : "Yarn v1 不支持 -local,跳过换源";
|
||||
chsrc_error (msg);
|
||||
// 不能直接退出,因为 Leader target 不能就此结束
|
||||
return;
|
||||
|
@@ -33,7 +33,7 @@ pl_nodejs_npm_setsrc (char *option)
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
if (CliOpt_Locally==true)
|
||||
if (chsrc_in_local_mode())
|
||||
cmd = xy_2strjoin ("npm config --location project set registry ", source.url);
|
||||
else
|
||||
cmd = xy_2strjoin ("npm config set registry ", source.url);
|
||||
|
@@ -34,7 +34,7 @@ pl_nodejs_pnpm_setsrc (char *option)
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
if (CliOpt_Locally)
|
||||
if (chsrc_in_local_mode())
|
||||
cmd = xy_2strjoin ("pnpm config --location project set registry ", source.url);
|
||||
else
|
||||
cmd = xy_2strjoin ("pnpm config -g set registry ", source.url);
|
||||
|
@@ -49,7 +49,7 @@ pl_php_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (pl_php);
|
||||
|
||||
char *where = " -g ";
|
||||
if (CliOpt_Locally==true)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
where = " ";
|
||||
}
|
||||
|
@@ -35,7 +35,7 @@ pl_python_pdm_setsrc (char *option)
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
if (CliOpt_Locally==true)
|
||||
if (chsrc_in_local_mode())
|
||||
cmd = xy_2strjoin ("pdm config --local pypi.url ", source.url);
|
||||
else
|
||||
cmd = xy_2strjoin ("pdm config --global pypi.url ", source.url);
|
||||
|
@@ -34,7 +34,7 @@ pl_python_poetry_setsrc (char *option)
|
||||
|
||||
char *cmd = NULL;
|
||||
|
||||
if (CliOpt_Locally==false)
|
||||
if (!chsrc_in_local_mode())
|
||||
chsrc_note2 ("Poertry 仅支持项目级换源");
|
||||
|
||||
cmd = xy_2strjoin ("poetry source add my_mirror ", source.url);
|
||||
|
@@ -44,7 +44,7 @@ void
|
||||
pl_python_setsrc (char *option)
|
||||
{
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "Three package managers will be replaced for you at the same time: " \
|
||||
char *msg = ENGLISH ? "Three package managers will be replaced for you at the same time: " \
|
||||
"pip, Poetry, PDM. If you need to change the source independently, " \
|
||||
"please run independently `chsrc set <pkg-manager>`"
|
||||
: "将同时为您更换4个包管理器 pip, Poetry, PDM, uv 的源,若需要独立换源,请独立运行 chsrc set <pkg-manager>";
|
||||
|
@@ -30,9 +30,9 @@ void
|
||||
pl_python_pip_setsrc (char *option)
|
||||
{
|
||||
// 对于不支持的情况,尽早结束
|
||||
if (CliOpt_Locally)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
char *msg = CliOpt_InEnglish ? "pip doesn't support `-local`. SKIP changing source!" : "pip 不支持 -local,跳过换源";
|
||||
char *msg = ENGLISH ? "pip doesn't support `-local`. SKIP changing source!" : "pip 不支持 -local,跳过换源";
|
||||
chsrc_error (msg);
|
||||
// 不能直接退出,因为 Leader target 不能就此结束
|
||||
return;
|
||||
|
@@ -27,7 +27,7 @@
|
||||
char *
|
||||
pl_python_find_uv_config (bool mkdir)
|
||||
{
|
||||
if (CliOpt_Locally)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
return xy_2strjoin (UV_LOCAL_CONFIG_PATH, UV_CONFIG);
|
||||
}
|
||||
|
@@ -83,7 +83,7 @@ pl_ruby_setsrc (char *option)
|
||||
chsrc_ensure_program ("bundle");
|
||||
|
||||
char *where = " --global ";
|
||||
if (CliOpt_Locally==true)
|
||||
if (chsrc_in_local_mode())
|
||||
{
|
||||
where = " --local ";
|
||||
}
|
||||
|
Reference in New Issue
Block a user