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
|
Rev | Line | |
---|
[3] | 1 | open Logarion
|
---|
| 2 | let 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] | 9 | open Cmdliner
|
---|
| 10 | let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories")
|
---|
| 11 | let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated authors" ~doc: "Topics by authors")
|
---|
| 12 | let topics_t = Term.(const topics $ recurse $ authed)
|
---|
| 13 |
|
---|
| 14 | let 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.