mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-02-24 05:38:13 +08:00
Format changing output
This commit is contained in:
parent
135444cd47
commit
e0fccebf53
@ -51,14 +51,25 @@ pl_nodejs_getsrc (char *option)
|
||||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
split_between_source_changing_process;
|
||||
|
||||
if (npm_exist)
|
||||
pl_nodejs_npm_getsrc (option);
|
||||
{
|
||||
pl_nodejs_npm_getsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
pl_nodejs_yarn_getsrc (option);
|
||||
{
|
||||
pl_nodejs_yarn_getsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
pl_nodejs_pnpm_getsrc (option);
|
||||
{
|
||||
pl_nodejs_pnpm_getsrc (option);
|
||||
say ("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -72,15 +83,25 @@ pl_nodejs_setsrc (char *option)
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
// chsrc_yield_source_and_confirm (pl_nodejs);
|
||||
split_between_source_changing_process;
|
||||
|
||||
if (npm_exist)
|
||||
pl_nodejs_npm_setsrc (option);
|
||||
{
|
||||
pl_nodejs_npm_setsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
pl_nodejs_yarn_setsrc (option);
|
||||
{
|
||||
pl_nodejs_yarn_setsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
pl_nodejs_pnpm_setsrc (option);
|
||||
{
|
||||
pl_nodejs_pnpm_setsrc (option);
|
||||
say ("");
|
||||
}
|
||||
|
||||
// chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
@ -107,7 +128,7 @@ pl_nodejs_feat (char *option)
|
||||
fi.can_get = true;
|
||||
fi.can_reset = true;
|
||||
|
||||
fi.stcan_locally = CanSemi;
|
||||
fi.stcan_locally = CanFully;
|
||||
fi.locally = "Support npm (chsrc v0.1.7)\nSupport yarn v2 (chsrc v0.1.8.1)\nSupport pnpm (chsrc v0.1.8.2)";
|
||||
fi.can_english = true;
|
||||
fi.can_user_define = true;
|
||||
|
@ -40,9 +40,9 @@ pl_nodejs_yarn_getsrc (char *option)
|
||||
if (pl_nodejs_yarn_get_yarn_version () >= 2)
|
||||
// https://github.com/RubyMetric/chsrc/issues/53
|
||||
// 从 Yarn V2 开始,使用新的配置名
|
||||
chsrc_run ("yarn config get npmRegistryServer", RunOpt_Default);
|
||||
chsrc_run ("yarn config get npmRegistryServer", RunOpt_No_Last_New_Line);
|
||||
else
|
||||
chsrc_run ("yarn config get registry", RunOpt_Default);
|
||||
chsrc_run ("yarn config get registry", RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
|
||||
@ -65,13 +65,13 @@ pl_nodejs_yarn_setsrc (char *option)
|
||||
else
|
||||
cmd = xy_2strjoin ("yarn config set npmRegistryServer --home ", source.url);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 不再阻止换源命令输出到终端,即不再调用 xy_str_to_quietcmd()
|
||||
cmd = xy_2strjoin ("yarn config set registry ", source.url);
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
|
@ -27,7 +27,7 @@ def_sources_n(pl_nodejs_npm);
|
||||
void
|
||||
pl_nodejs_npm_getsrc (char *option)
|
||||
{
|
||||
chsrc_run ("npm config get registry", RunOpt_Default);
|
||||
chsrc_run ("npm config get registry", RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ pl_nodejs_npm_setsrc (char *option)
|
||||
else
|
||||
cmd = xy_2strjoin ("npm config set registry ", source.url);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ def_sources_n(pl_nodejs_pnpm);
|
||||
void
|
||||
pl_nodejs_pnpm_getsrc (char *option)
|
||||
{
|
||||
chsrc_run ("pnpm config get registry", RunOpt_Default);
|
||||
chsrc_run ("pnpm config get registry", RunOpt_No_Last_New_Line);
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ pl_nodejs_pnpm_setsrc (char *option)
|
||||
else
|
||||
cmd = xy_2strjoin ("pnpm config -g set registry ", source.url);
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
chsrc_run (cmd, RunOpt_No_Last_New_Line);
|
||||
|
||||
chsrc_conclude (&source, ChsrcTypeAuto);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user