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

Last change on this file since 67 was 66, checked in by Izuru Yakumo, 8 months ago

Migrate the codebase to the latest revision of Cmdliner

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

File size: 860 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
[66]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" ~version:"%%VERSION%%" ~doc ~man in
21 Cmd.v info topics_t
Note: See TracBrowser for help on using the repository browser.