Support -local for composer

[Gitee link #I9V5I0]
This commit is contained in:
Aoran Zeng 2024-06-11 22:18:35 +08:00
parent 7d72955c56
commit 36c80c8c1e

View File

@ -72,13 +72,13 @@ pl_ruby_setsrc (char *option)
return; return;
} }
char *where = "--global"; char *where = " --global ";
if (Cli_Option_Locally==true) if (Cli_Option_Locally==true)
{ {
where = "--local"; where = " --local ";
} }
cmd = xy_strjoin (4, "bundle config ", where, " 'mirror.https://rubygems.org' ", source.url); cmd = xy_strjoin (4, "bundle config", where, "'mirror.https://rubygems.org' ", source.url);
chsrc_run (cmd); chsrc_run (cmd);
chsrc_say_lastly (&source, chsrc_type); chsrc_say_lastly (&source, chsrc_type);
@ -175,13 +175,13 @@ pl_python_setsrc (char *option)
if (pdm_exist) { if (pdm_exist) {
char *where = "--global"; char *where = " --global ";
if (Cli_Option_Locally==true) if (Cli_Option_Locally==true)
{ {
where = "--local"; where = " --local ";
} }
cmd = xy_strjoin (4, "pdm config ", where, " pypi.url ", source.url); cmd = xy_strjoin (4, "pdm config", where, "pypi.url ", source.url);
chsrc_run (cmd); chsrc_run (cmd);
} }
@ -252,15 +252,15 @@ pl_nodejs_setsrc (char *option)
char *cmd = NULL; char *cmd = NULL;
char *where = ""; char *where = " ";
if (Cli_Option_Locally==true) if (Cli_Option_Locally==true)
{ {
where = "--location project "; where = " --location project ";
} }
if (npm_exist) if (npm_exist)
{ {
cmd = xy_strjoin (4, "npm config ", where, "set registry ", source.url); cmd = xy_strjoin (4, "npm config", where, "set registry ", source.url);
chsrc_run (cmd); chsrc_run (cmd);
} }
@ -364,7 +364,13 @@ pl_php_setsrc (char *option)
SourceInfo source = pl_php_sources[index]; SourceInfo source = pl_php_sources[index];
chsrc_confirm_selection (&source); chsrc_confirm_selection (&source);
char* cmd = xy_2strjoin ("composer config -g repo.packagist composer ", source.url); char *where = " -g ";
if (Cli_Option_Locally==true)
{
where = " ";
}
char *cmd = xy_strjoin (4, "composer config", where, "repo.packagist composer ", source.url);
chsrc_run (cmd); chsrc_run (cmd);
chsrc_say_lastly (&source, ChsrcTypeSemiAuto); chsrc_say_lastly (&source, ChsrcTypeSemiAuto);