mirror of
https://github.com/RubyMetric/chsrc
synced 2025-10-20 18:05:08 +08:00
Refactor target group mode
This commit is contained in:
@@ -74,7 +74,7 @@ pl_nodejs_setsrc (char *option)
|
||||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
ProgMode_Target_Group = true;
|
||||
chsrc_set_target_group_mode ();
|
||||
chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
|
||||
if (npm_exist)
|
||||
|
@@ -42,7 +42,7 @@ pl_nodejs_yarn_setsrc (char *option)
|
||||
{
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
@@ -71,7 +71,7 @@ pl_nodejs_yarn_setsrc (char *option)
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@@ -28,7 +28,7 @@ pl_nodejs_npm_setsrc (char *option)
|
||||
{
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
@@ -40,7 +40,7 @@ pl_nodejs_npm_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@@ -29,7 +29,7 @@ pl_nodejs_pnpm_setsrc (char *option)
|
||||
{
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_nodejs);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
@@ -41,7 +41,7 @@ pl_nodejs_pnpm_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@@ -30,7 +30,7 @@ pl_python_pdm_setsrc (char *option)
|
||||
{
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_python);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
@@ -42,7 +42,7 @@ pl_python_pdm_setsrc (char *option)
|
||||
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@@ -29,7 +29,7 @@ pl_python_poetry_setsrc (char *option)
|
||||
{
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_python);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *cmd = NULL;
|
||||
@@ -40,7 +40,7 @@ pl_python_poetry_setsrc (char *option)
|
||||
cmd = xy_2strjoin ("poetry source add my_mirror ", source.url);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
@@ -57,7 +57,7 @@ pl_python_setsrc (char *option)
|
||||
|
||||
pl_python_check_unofficial_pkger (&poetry_exist, &pdm_exist, &uv_exist);
|
||||
|
||||
ProgMode_Target_Group = true;
|
||||
chsrc_set_target_group_mode ();
|
||||
chsrc_yield_source_and_confirm (pl_python);
|
||||
|
||||
|
||||
|
@@ -40,7 +40,7 @@ pl_python_pip_setsrc (char *option)
|
||||
|
||||
Source_t source;
|
||||
chsrc_yield_for_the_source (pl_python);
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
chsrc_confirm_source;
|
||||
|
||||
char *py_prog_name = NULL;
|
||||
@@ -52,7 +52,7 @@ pl_python_pip_setsrc (char *option)
|
||||
char *cmd = xy_2strjoin (py_prog_name, xy_2strjoin (" -m pip config --user set global.index-url ", source.url));
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
if (ProgMode_Target_Group!=true)
|
||||
if (!chsrc_in_target_group_mode())
|
||||
{
|
||||
chsrc_determine_chgtype (ChgType_Auto);
|
||||
chsrc_conclude (&source);
|
||||
|
Reference in New Issue
Block a user