mirror of
https://github.com/RubyMetric/chsrc
synced 2025-12-23 02:51:53 +08:00
Split ocaml out
This commit is contained in:
40
src/chsrc.c
40
src/chsrc.c
@@ -175,45 +175,7 @@ pl_haskell_setsrc (char *option)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
pl_ocaml_check_cmd ()
|
||||
{
|
||||
chsrc_ensure_program ("opam");
|
||||
}
|
||||
|
||||
void
|
||||
pl_ocaml_getsrc(char *option)
|
||||
{
|
||||
pl_ocaml_check_cmd ();
|
||||
chsrc_run ("opam repo get-url default", RunOpt_Default);
|
||||
}
|
||||
|
||||
/**
|
||||
* 参考: https://mirrors.sjtug.sjtu.edu.cn/docs/git/opam-repository.git
|
||||
*/
|
||||
void
|
||||
pl_ocaml_setsrc(char *option)
|
||||
{
|
||||
pl_ocaml_check_cmd ();
|
||||
|
||||
SourceInfo source;
|
||||
chsrc_yield_source (pl_ocaml);
|
||||
chsrc_confirm_source (&source);
|
||||
|
||||
char *cmd = xy_strjoin (3, "opam repo set-url default ",
|
||||
source.url,
|
||||
" --all --set-default");
|
||||
|
||||
chsrc_run (cmd, RunOpt_Default);
|
||||
|
||||
chsrc_note2 ("如果是首次使用 opam ,请使用以下命令进行初始化");
|
||||
puts (xy_2strjoin ("opam init default ", source.url));
|
||||
|
||||
chsrc_say_lastly (&source, ChsrcTypeSemiAuto);
|
||||
}
|
||||
|
||||
|
||||
#include "recipe/lang/ocaml.c"
|
||||
|
||||
void
|
||||
pl_r_getsrc (char *option)
|
||||
|
||||
Reference in New Issue
Block a user