Skip to content

Commit 7011fc1

Browse files
committed
Update pl recipes
1 parent 00f6dea commit 7011fc1

File tree

5 files changed

+38
-20
lines changed

5 files changed

+38
-20
lines changed

src/recipe/lang/Haskell.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* File Authors : Aoran Zeng <[email protected]>
55
* Contributors : Nil Null <[email protected]>
66
* Created On : <2023-09-10>
7-
* Last Modified : <2025-07-16>
7+
* Last Modified : <2025-07-21>
88
* ------------------------------------------------------------*/
99

1010
#include "rawstr4c.h"
@@ -33,9 +33,13 @@ pl_haskell_setsrc (char *option)
3333
{
3434
chsrc_yield_source_and_confirm (pl_haskell);
3535

36-
char *file = xy_strjoin (3, "repository mirror\n"
37-
" url: ", source.url,
38-
"\n secure: True");
36+
char *file = R"(
37+
repository mirror
38+
url: @url@
39+
secure: True
40+
)";
41+
42+
file = xy_str_gsub (file, "@url@", source.url);
3943

4044
char *config = NULL;
4145
if (xy_on_windows)
@@ -48,7 +52,7 @@ pl_haskell_setsrc (char *option)
4852
}
4953

5054
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
51-
println (file); br();
55+
println (file);
5256

5357
config = xy_normalize_path ("~/.stack/config.yaml");
5458
file = xy_str_gsub (RAWSTR_pl_haskell_stackage_yaml, "@url@", source.url);

src/recipe/lang/Node.js/Bun.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* File Authors : Aoran Zeng <[email protected]>
55
* Contributors : Lontten <[email protected]>
66
* Created On : <2024-09-29>
7-
* Last Modified : <2025-07-11>
7+
* Last Modified : <2025-07-21>
88
* ------------------------------------------------------------*/
99

1010
/**
@@ -30,8 +30,13 @@ pl_nodejs_bun_setsrc (char *option)
3030
// 用的是 npm Registry 的源
3131
chsrc_yield_source (pl_nodejs_group);
3232

33-
char *file = xy_strjoin(3, "[install]\n"
34-
"registry = \"", source.url, "\"");
33+
char *file =
34+
R"(
35+
[install]
36+
registry = "@url@"
37+
)";
38+
39+
file = xy_str_gsub (file, "@url@", source.url);
3540

3641
if (chsrc_in_local_mode())
3742
{

src/recipe/lang/Node.js/Node.js.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pl_nodejs_check_cmd (bool *npm_exist, bool *yarn_exist, bool *pnpm_exist)
1919
if (!*npm_exist && !*yarn_exist && !*pnpm_exist)
2020
{
2121
char *msg = ENGLISH ? "No npm, yarn or pnpm command found, check if at least one is present"
22-
: "未找到 npm 或 yarn 或 pnpm 命令,请检查是否存在其一";
22+
: "未找到 npm 或 yarn 或 pnpm 命令,请检查是否存在其一";
2323
chsrc_error (msg);
2424
exit (Exit_UserCause);
2525
}

src/recipe/lang/Python/Rye.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* File Authors : Aoran Zeng <[email protected]>
55
* Contributors : Nul None <[email protected]>
66
* Created On : <2024-12-06>
7-
* Last Modified : <2025-07-11>
7+
* Last Modified : <2025-07-21>
88
*
99
* 由于Rye已经有后继uv了,所以我们不把该管理器纳入Python group中
1010
* ------------------------------------------------------------*/
@@ -41,10 +41,15 @@ pl_python_rye_setsrc (char *option)
4141
/* 并不在 Python group 中,所以不考虑 target group 情况 */
4242
chsrc_yield_source_and_confirm (pl_python_group);
4343

44-
const char *file = xy_strjoin (7,
45-
"[[sources]]\n",
46-
"name = \"", source.mirror->abbr, "\"\n",
47-
"url = \"", source.url, "\"");
44+
const char *file =
45+
R"(
46+
[[sources]]
47+
name = "@1@"
48+
url = "@2@"
49+
)";
50+
51+
file = xy_str_gsub (file, "@1@", source.mirror->abbr);
52+
file = xy_str_gsub (file, "@2@", source.url);
4853

4954
char *rye_config = pl_python_find_rye_config ();
5055
chsrc_note2 (xy_strjoin (3, "请在配置文件 ", rye_config, " 中添加:"));

src/recipe/lang/Rust/Cargo.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,19 @@ pl_rust_cargo_setsrc (char *option)
8484
{
8585
chsrc_yield_source_and_confirm (pl_rust_cargo);
8686

87-
const char* file = xy_strjoin (3,
88-
"[source.crates-io]\n"
89-
"replace-with = 'mirror'\n\n"
87+
const char *file =
88+
R"toml(
89+
[source.crates-io]
90+
replace-with = 'mirror'
9091

91-
"[source.mirror]\n"
92-
"registry = \"sparse+", source.url, "\"");
92+
[source.mirror]
93+
registry = "sparse+@url@"
94+
)toml";
95+
96+
file = xy_str_gsub (file, "@url@", source.url);
9397

9498
chsrc_note2 (xy_strjoin (3, "请手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
95-
p(file);
99+
println (file);
96100

97101
chsrc_determine_chgtype (ChgType_Auto);
98102
chsrc_conclude (&source);

0 commit comments

Comments
 (0)