source: code/trunk/cli/topics.ml@ 65

Last change on this file since 65 was 65, checked in by yakumo.izuru, 8 months ago

Replace Cmdliner with Ocmd, re-add documentation

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

File size: 745 bytes
RevLine 
[3]1open Logarion
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
[65]9open Ocmd
[3]10let term =
11 let recurse = Arg.(value & flag & info ["R"]
12 ~doc:"include texts in subdirectories") in
13 let authed = Arg.(value & opt (some string) None & info ["authored"]
14 ~docv:"comma-separated authors" ~doc:"topics by authors") in
15 Term.(const topics $ recurse $ authed),
16 Term.info "topics" ~doc:"list topics" ~man:[ `S "DESCRIPTION";
17 `P "List of topics" ]
Note: See TracBrowser for help on using the repository browser.