source: code/trunk/cmd/txt/authors.ml

Last change on this file was 73, checked in by Izuru Yakumo, 8 months ago

Because sweet girls are the best, officially rebranding Logarion to Kosuzu

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 869 bytes
Line 
1open Kosuzu
2let authors r topics_opt =
3 let predicates = Archive.(predicate topics topics_opt) in
4 let predicate text = List.fold_left (fun a e -> a && e text) true predicates in
5 let author_union a (e, _) = Person.Set.union a e.Text.authors in
6 let s = File_store.fold ~r ~predicate author_union Person.Set.empty in
7 Person.Set.iter (fun x -> print_endline (Person.to_string x)) s
8
9open Cmdliner
10let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories too")
11let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv:"topics" ~doc: "Display authors who have written on topics")
12
13let authors_t = Term.(const authors $ recurse $ topics)
14
15let cmd =
16 let doc = "List authors" in
17 let man = [
18 `S Manpage.s_description;
19 `P "List author names" ]
20 in
21 let info = Cmd.info "authors" ~doc ~man in
22 Cmd.v info authors_t
Note: See TracBrowser for help on using the repository browser.