Skip to content

Commit 36c80c8

Browse files
committed
Support -local for composer
[Gitee link #I9V5I0]
1 parent 7d72955 commit 36c80c8

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

src/chsrc.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,13 @@ pl_ruby_setsrc (char *option)
7272
return;
7373
}
7474

75-
char *where = "--global";
75+
char *where = " --global ";
7676
if (Cli_Option_Locally==true)
7777
{
78-
where = "--local";
78+
where = " --local ";
7979
}
8080

81-
cmd = xy_strjoin (4, "bundle config ", where, " 'mirror.https://rubygems.org' ", source.url);
81+
cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
8282
chsrc_run (cmd);
8383

8484
chsrc_say_lastly (&source, chsrc_type);
@@ -175,13 +175,13 @@ pl_python_setsrc (char *option)
175175

176176
if (pdm_exist) {
177177

178-
char *where = "--global";
178+
char *where = " --global ";
179179
if (Cli_Option_Locally==true)
180180
{
181-
where = "--local";
181+
where = " --local ";
182182
}
183183

184-
cmd = xy_strjoin (4, "pdm config ", where, " pypi.url ", source.url);
184+
cmd = xy_strjoin (4, "pdm config", where, "pypi.url ", source.url);
185185
chsrc_run (cmd);
186186
}
187187

@@ -252,15 +252,15 @@ pl_nodejs_setsrc (char *option)
252252

253253
char *cmd = NULL;
254254

255-
char *where = "";
255+
char *where = " ";
256256
if (Cli_Option_Locally==true)
257257
{
258-
where = "--location project ";
258+
where = " --location project ";
259259
}
260260

261261
if (npm_exist)
262262
{
263-
cmd = xy_strjoin (4, "npm config ", where, "set registry ", source.url);
263+
cmd = xy_strjoin (4, "npm config", where, "set registry ", source.url);
264264
chsrc_run (cmd);
265265
}
266266

@@ -364,7 +364,13 @@ pl_php_setsrc (char *option)
364364
SourceInfo source = pl_php_sources[index];
365365
chsrc_confirm_selection (&source);
366366

367-
char* cmd = xy_2strjoin ("composer config -g repo.packagist composer ", source.url);
367+
char *where = " -g ";
368+
if (Cli_Option_Locally==true)
369+
{
370+
where = " ";
371+
}
372+
373+
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
368374
chsrc_run (cmd);
369375

370376
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);

0 commit comments

Comments
 (0)