Files
kosuzu/cli/read.ml
yakumo.izuru d310d041ce Migrate the codebase to the latest revision of Cmdliner
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@66 eb64cd80-c68d-6f47-b6a3-0ada418499da
2024-08-21 01:37:05 +00:00

25 lines
1.1 KiB
OCaml

open Logarion
open Cmdliner
let id = Arg.(value & pos 0 string "" & info [] ~docv:"text ID")
let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs")
let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order")
let time = Arg.(value & flag & info ["t"] ~doc:"sort by time, newest first")
let number = Arg.(value & opt (some int) None & info ["n"] ~docv:"number" ~doc:"number of entries to list")
let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv:"comma-separated names" ~doc:"texts by authors")
let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv:"comma-separated topics" ~doc:"texts with topics")
let read_t = Term.(const (Archive.apply_sys_util "PAGER" "less") $ recurse $ time $ reverse $ number $ authed $ topics $ id)
let cmd =
let doc = "Read a text" in
let man = [
`S Manpage.s_description;
`P "Deprecated. This subcommand will be removed in a future release of Logarion";
`P "This invokes the PAGER utility ('less' if unset) on an article of the archive" ]
in
let info = Cmd.info "read" ~version:"%%VERSION%%" ~doc ~man in
Cmd.v info read_t