Initialise to .logarion
This commit is contained in:
parent
9acf043870
commit
f823e3bc71
@ -7,7 +7,7 @@ let conf () =
|
||||
let module Config = Confix.Config.Make (Confix.ConfixToml) in
|
||||
let archive_res =
|
||||
let open Confix.Config in
|
||||
Confix.Config.Path.with_file "config.toml"
|
||||
Confix.Config.Path.with_file ".logarion/config.toml"
|
||||
&> Config.from_path
|
||||
|> Config.to_record C.of_config
|
||||
in
|
||||
@ -20,17 +20,32 @@ let init force =
|
||||
| [] -> ()
|
||||
| (dir,descr)::tl ->
|
||||
match Bos.OS.Dir.create (Fpath.v dir) with
|
||||
| Ok true -> print_endline ("Created empty " ^ descr); create_dirs tl
|
||||
| Ok false -> print_endline ("Reinitialise existing " ^ descr); create_dirs tl
|
||||
| Ok true -> print_endline ("Created " ^ descr ^ " directory in " ^ dir); create_dirs tl
|
||||
| Ok false -> print_endline ("Reinitialise existing " ^ descr ^ " directory in " ^ dir); create_dirs tl
|
||||
| Error (`Msg msg) -> prerr_endline @@ "Failed making " ^ descr ^ ". " ^ msg
|
||||
in
|
||||
let rec make_copies = function
|
||||
| [] -> ()
|
||||
| (source,dest)::tl ->
|
||||
let recursive = true in
|
||||
match Bos.OS.Cmd.run (Bos.Cmd.(v "cp" %% (on recursive @@ v "-r") % source % dest)) with
|
||||
| Ok () -> make_copies tl
|
||||
| Error (`Msg msg) -> prerr_endline msg
|
||||
in
|
||||
let dirs = [
|
||||
".logarion", "Logarion directory";
|
||||
".logarion/static", "static file directory";
|
||||
".logarion/html-templates", "template directory";
|
||||
".logarion", "Logarion";
|
||||
".logarion/static", "static files";
|
||||
".logarion/html-templates", "templates";
|
||||
]
|
||||
in
|
||||
create_dirs dirs
|
||||
let copies = [
|
||||
"config.toml", ".logarion/";
|
||||
"share/static", ".logarion/";
|
||||
"share/html_templates", ".logarion/";
|
||||
]
|
||||
in
|
||||
create_dirs dirs;
|
||||
make_copies copies
|
||||
|
||||
let init_term =
|
||||
let force =
|
||||
|
Loading…
x
Reference in New Issue
Block a user