source: code/trunk/cmd/txt/topics.ml@ 77

Last change on this file since 77 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: 835 bytes
Line 
1open Kosuzu
2let topics r authors_opt =
3 let predicates = Archive.(predicate authored authors_opt) in
4 let predicate text = List.fold_left (fun a e -> a && e text) true predicates in
5 let topic_union a (e, _) = String_set.union a (Text.set "topics" e) in
6 let s = File_store.fold ~r ~predicate topic_union String_set.empty in
7 print_endline @@ String_set.to_string s
8
9open Cmdliner
10let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories")
11let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated authors" ~doc: "Topics by authors")
12let topics_t = Term.(const topics $ recurse $ authed)
13
14let cmd =
15 let doc = "List topics" in
16 let man = [
17 `S Manpage.s_description;
18 `P "List of topics" ]
19 in
20 let info = Cmd.info "topics" ~doc ~man in
21 Cmd.v info topics_t
Note: See TracBrowser for help on using the repository browser.