Show different location based on -local for Bun

This commit is contained in:
Aoran Zeng 2024-10-02 21:49:01 +08:00
parent 60e611edd4
commit 0c10b1b1d1
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98

View File

@ -20,6 +20,7 @@ pl_nodejs_bun_getsrc (char *option)
/**
* @consult https://bun.sh/docs/runtime/bunfig#global-vs-local
* @consult https://github.com/RubyMetric/chsrc/issues/83
* @consult https://github.com/RubyMetric/chsrc/pull/90
*
* chsrc set bun
*/
@ -27,14 +28,23 @@ void
pl_nodejs_bun_setsrc (char *option)
{
char *setsrc_type = xy_streql (option, SetsrcType_Reset) ? SetsrcType_Reset : SetsrcType_Manual;
// 用的是 npm Registry 的源
chsrc_yield_source (pl_nodejs);
char *file = xy_strjoin(3, "[install]\n"
"registry = \"", source.url, "\"");
chsrc_note2 (xy_strjoin (3, "(全局配置)请您手动写入以下内容到 ", xy_uniform_path ("~/.bunfig.toml"), " 文件中(如果只是配置项目级,则写入到项目根目录的 bunfig.toml 文件中。):"));
puts (file);
if (CliOpt_Locally==true)
{
chsrc_note2 ("请您手动写入以下内容到本项目根目录的 bunfig.toml 文件中");
}
else
{
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_uniform_path ("~/.bunfig.toml"), " 文件中"));
}
puts (file);
chsrc_conclude (&source, setsrc_type);
}