Add repository owner as author name when using create command

This commit is contained in:
Stavros Polymenis 2017-11-03 00:37:13 +00:00
parent c2286d0772
commit 328e6da91e

View File

@ -73,10 +73,17 @@ let create_term =
Arg.(value & pos 0 string "" & info [] ~docv:"TITLE" ~doc:"Title for new article")
in
let f title =
let repo = (conf ()).C.repository in
let conf = conf () in
let t = match title with "" -> "Draft" | _ -> title in
let note = Note.({ (blank ()) with meta = { (Meta.blank ()) with Meta.title = t }}) in
File.Lwt.with_note (File.store repo) note
let note =
let meta =
let open Meta in
let author = Author.({ name = conf.C.owner; email = Email.of_string conf.C.email }) in
{ (blank ()) with title = t; author }
in
Note.({ (blank ()) with meta })
in
File.Lwt.with_note (File.store conf.C.repository) note
|> Lwt_main.run
|> ignore
in