Files
kosuzu/cli/authors.ml
yakumo.izuru 3f090772ce Replace Cmdliner with Ocmd, re-add documentation
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@65 eb64cd80-c68d-6f47-b6a3-0ada418499da
2024-08-20 13:17:24 +00:00

18 lines
775 B
OCaml

open Logarion
let authors r topics_opt =
let predicates = Archive.(predicate topics topics_opt) in
let predicate text = List.fold_left (fun a e -> a && e text) true predicates in
let author_union a (e, _) = Person.Set.union a e.Text.authors in
let s = File_store.fold ~r ~predicate author_union Person.Set.empty in
Person.Set.iter (fun x -> print_endline (Person.to_string x)) s
open Ocmd
let term =
let recurse = Arg.(value & flag & info ["R"]
~doc:"include texts in subdirectories too") in
let topics = Arg.(value & opt (some string) None & info ["topics"]
~docv:"TOPICS" ~doc:"display authors who have written on topics") in
Term.(const authors $ recurse $ topics),
Term.info "authors" ~doc:"list authors"
~man:[ `S "DESCRIPTION"; `P "List author names" ]