kosuzu/cli/topics.ml
yakumo.izuru 1a0bf17e36 txt new no longer sets default titles, remove %%VERSION%% from all subcommands (as they're pulled from txt.ml)
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@69 eb64cd80-c68d-6f47-b6a3-0ada418499da
2024-08-21 11:14:12 +00:00

22 lines
837 B
OCaml

open Logarion
let topics r authors_opt =
let predicates = Archive.(predicate authored authors_opt) in
let predicate text = List.fold_left (fun a e -> a && e text) true predicates in
let topic_union a (e, _) = String_set.union a (Text.set "topics" e) in
let s = File_store.fold ~r ~predicate topic_union String_set.empty in
print_endline @@ String_set.to_string s
open Cmdliner
let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories")
let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated authors" ~doc: "Topics by authors")
let topics_t = Term.(const topics $ recurse $ authed)
let cmd =
let doc = "List topics" in
let man = [
`S Manpage.s_description;
`P "List of topics" ]
in
let info = Cmd.info "topics" ~doc ~man in
Cmd.v info topics_t