mirror of
https://github.com/RubyMetric/chsrc.git
synced 2025-03-13 07:55:12 +08:00
Add print macro
Some checks are pending
Publish AUR Package (chsrc-git) / publish (push) Waiting to run
Some checks are pending
Publish AUR Package (chsrc-git) / publish (push) Waiting to run
This commit is contained in:
parent
2746fe03c0
commit
6ded3380e5
@ -75,10 +75,11 @@ bool xy_enable_color = true;
|
||||
void putf (double n) { printf ("%f\n", n); }
|
||||
void puti (long long n) { printf ("%lld\n", n); }
|
||||
void putb (bool n) { if (n) puts ("true"); else puts ("false"); }
|
||||
void print (const char *s) { printf ("%s", s); }
|
||||
void println (const char *s) { printf ("%s\n", s);}
|
||||
void say (const char *s) { printf ("%s\n", s);}
|
||||
void br () { puts ("");}
|
||||
void print (const char *s) { printf ("%s", s); }
|
||||
void println (const char *s) { printf ("%s\n", s); }
|
||||
void say (const char *s) { printf ("%s\n", s); }
|
||||
void br () { puts (""); }
|
||||
void p (const char *s) { printf ("%s\n", s); }
|
||||
|
||||
#define assert_str(a, b) assert (xy_streql ((a), (b)))
|
||||
|
||||
|
@ -819,11 +819,7 @@ source_has_empty_url (Source_t *source)
|
||||
|
||||
|
||||
|
||||
static inline void
|
||||
divide_source_changing_process ()
|
||||
{
|
||||
say ("--------------------------------");
|
||||
}
|
||||
#define hr() say ("--------------------------------");
|
||||
|
||||
|
||||
/**
|
||||
@ -861,7 +857,7 @@ confirm_source (Source_t *source)
|
||||
say (xy_strjoin (5, msg, green (source->mirror->abbr), " (", green (source->mirror->code), ")"));
|
||||
}
|
||||
|
||||
divide_source_changing_process();
|
||||
hr();
|
||||
}
|
||||
|
||||
#define chsrc_yield_source_and_confirm(for_what) chsrc_yield_source(for_what);chsrc_confirm_source
|
||||
@ -899,7 +895,7 @@ confirm_source (Source_t *source)
|
||||
void
|
||||
chsrc_conclude (Source_t *source)
|
||||
{
|
||||
divide_source_changing_process();
|
||||
hr();
|
||||
|
||||
// fprintf (stderr, "chsrc: now change type: %d\n", ProgMode_ChgType);
|
||||
|
||||
|
@ -26,7 +26,7 @@ pl_clojure_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (pl_clojure);
|
||||
|
||||
chsrc_note2 ("抱歉,Clojure换源较复杂,您可手动查阅并换源:");
|
||||
say (source.url);
|
||||
p(source.url);
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ pl_haskell_setsrc (char *option)
|
||||
" ignore-expiry: no");
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请向 ", config, " 中手动添加:"));
|
||||
say (file);
|
||||
p(file);
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ pl_java_setsrc (char *option)
|
||||
"}");
|
||||
|
||||
chsrc_note2 ("请在您的 build.gradle 中添加:");
|
||||
say (file);
|
||||
p(file);
|
||||
}
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -52,7 +52,7 @@ pl_lua_setsrc (char *option)
|
||||
"server = \"", source.url, "\"");
|
||||
|
||||
chsrc_note2 ("请手动修改 ~/.luarocks/upload_config.lua 文件 (用于上传):");
|
||||
say (upload_config);
|
||||
p(upload_config);
|
||||
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -42,7 +42,7 @@ pl_nodejs_bun_setsrc (char *option)
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.bunfig.toml"), " 文件中"));
|
||||
}
|
||||
|
||||
say (file);
|
||||
p(file);
|
||||
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
@ -35,24 +35,24 @@ pl_nodejs_getsrc (char *option)
|
||||
bool npm_exist, yarn_exist, pnpm_exist;
|
||||
pl_nodejs_check_cmd (&npm_exist, &yarn_exist, &pnpm_exist);
|
||||
|
||||
divide_source_changing_process();
|
||||
hr();
|
||||
|
||||
if (npm_exist)
|
||||
{
|
||||
pl_nodejs_npm_getsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
{
|
||||
pl_nodejs_yarn_getsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
{
|
||||
pl_nodejs_pnpm_getsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,13 +80,13 @@ pl_nodejs_setsrc (char *option)
|
||||
if (npm_exist)
|
||||
{
|
||||
pl_nodejs_npm_setsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (yarn_exist)
|
||||
{
|
||||
pl_nodejs_yarn_setsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (pnpm_exist)
|
||||
|
@ -48,7 +48,7 @@ pl_ocaml_setsrc(char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
||||
say (xy_2strjoin ("opam init default ", source.url));
|
||||
p(xy_2strjoin ("opam init default ", source.url));
|
||||
|
||||
ProgMode_ChgType = ChgType_SemiAuto;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -54,7 +54,7 @@ pl_perl_setsrc (char *option)
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("请您使用 perl -v 以及 cpan -v,若 Perl >= v5.36 或 CPAN >= 2.29,请额外手动调用下面的命令");
|
||||
say ("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
|
||||
p("perl -MCPAN -e \"CPAN::HandleConfig->load(); CPAN::HandleConfig->edit('pushy_https', 0);; CPAN::HandleConfig->commit()\"");
|
||||
|
||||
ProgMode_ChgType = ChgType_SemiAuto;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -20,19 +20,19 @@ pl_python_getsrc (char *option)
|
||||
|
||||
// 交给后面检查命令的存在性
|
||||
pl_python_pip_getsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
|
||||
if (poetry_exist)
|
||||
{
|
||||
pl_python_poetry_getsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (pdm_exist)
|
||||
{
|
||||
pl_python_pdm_getsrc (option);
|
||||
}
|
||||
|
||||
|
||||
if (uv_exist)
|
||||
{
|
||||
pl_python_uv_getsrc (option);
|
||||
@ -63,19 +63,19 @@ pl_python_setsrc (char *option)
|
||||
|
||||
// 交给后面检查命令的存在性
|
||||
pl_python_pip_setsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
|
||||
if (poetry_exist)
|
||||
{
|
||||
pl_python_poetry_setsrc (option);
|
||||
say ("");
|
||||
br();
|
||||
}
|
||||
|
||||
if (pdm_exist)
|
||||
{
|
||||
pl_python_pdm_setsrc (option);
|
||||
}
|
||||
|
||||
|
||||
if (uv_exist)
|
||||
{
|
||||
pl_python_uv_setsrc (option);
|
||||
|
@ -55,7 +55,7 @@ pl_rust_cargo_setsrc (char *option)
|
||||
"registry = \"sparse+", source.url, "\"");
|
||||
|
||||
chsrc_note2 (xy_strjoin (3, "请您手动写入以下内容到 ", xy_normalize_path ("~/.cargo/config.toml"), " 文件中:"));
|
||||
say (file);
|
||||
p(file);
|
||||
ProgMode_ChgType = ProgMode_CMD_Reset ? ChgType_Reset : ChgType_Auto;
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ os_voidlinux_setsrc (char *option)
|
||||
);
|
||||
|
||||
chsrc_note2 ("若报错可尝试使用以下命令:");
|
||||
say (cmd);
|
||||
p(cmd);
|
||||
ProgMode_ChgType = ChgType_Untested;
|
||||
chsrc_conclude (&source);
|
||||
}
|
||||
|
@ -28,16 +28,15 @@ wr_cocoapods_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (wr_cocoapods);
|
||||
|
||||
chsrc_note2 ("请手动执行以下命令:");
|
||||
|
||||
say ("cd ~/.cocoapods/repos");
|
||||
say ("pod repo remove master");
|
||||
p("cd ~/.cocoapods/repos");
|
||||
p("pod repo remove master");
|
||||
char *git_cmd = xy_strjoin (3, "git clone ", source.url, " master");
|
||||
say (git_cmd);
|
||||
say ("");
|
||||
p(git_cmd);
|
||||
br();
|
||||
|
||||
chsrc_note2 ("最后进入项目工程目录,在Podfile中第一行加入:");
|
||||
char *source_str = xy_strjoin (3, "source '", source.url, "'");
|
||||
say (source_str);
|
||||
p(source_str);
|
||||
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -36,7 +36,7 @@ wr_emacs_setsrc (char *option)
|
||||
chsrc_yield_source_and_confirm (wr_emacs);
|
||||
|
||||
chsrc_note2 ("Emacs换源涉及Elisp,需要手动查阅并换源:");
|
||||
say (source.url);
|
||||
p(source.url);
|
||||
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -32,7 +32,7 @@ wr_guix_setsrc (char *option)
|
||||
" (url \"", source.url, "\")))");
|
||||
|
||||
chsrc_note2 ("为防止扰乱配置文件,请您手动写入以下内容到 ~/.config/guix/channels.scm 文件中");
|
||||
say (file);
|
||||
p(file);
|
||||
|
||||
ProgMode_ChgType = ChgType_Manual;
|
||||
chsrc_conclude (&source);
|
||||
|
@ -50,11 +50,11 @@ wr_nix_setsrc (char *option)
|
||||
|
||||
chsrc_note2 ("若您使用的是NixOS,请确认您的系统版本<version>(如22.11),并手动运行:");
|
||||
cmd = xy_strjoin (3, "nix-channel --add ", source.url, "nixpkgs-<version> nixpkgs");
|
||||
say (cmd);
|
||||
p(cmd);
|
||||
|
||||
cmd = xy_strjoin (3, "nix.settings.substituters = [ \"", source.url, "store\" ];");
|
||||
chsrc_note2 ("若您使用的是NixOS,请额外添加下述内容至 configuration.nix 中");
|
||||
say (cmd);
|
||||
p(cmd);
|
||||
|
||||
ProgMode_ChgType = ChgType_SemiAuto;
|
||||
chsrc_conclude (&source);
|
||||
|
Loading…
x
Reference in New Issue
Block a user