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
This commit is contained in:
yakumo.izuru
2024-08-21 01:37:05 +00:00
parent 3f090772ce
commit d310d041ce
17 changed files with 271 additions and 233 deletions

View File

@@ -2,20 +2,22 @@ open Logarion
module FS = File_store
module A = Archive
open Ocmd
let term =
let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in
let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in
let paths = Arg.(value & flag & info ["p"] ~doc:"show file paths") in
let number = Arg.(value & opt (some int) (Some 10) & info ["n"]
~docv:"number" ~doc:"number of entries to list") in
let authed = Arg.(value & opt (some string) None & info ["authored"]
~docv:"comma-separated names" ~doc:"texts by authors") in
let topics = Arg.(value & opt (some string) None & info ["topics"]
~docv:"comma-separated topics" ~doc:"texts with topics") in
let dir = Arg.(value & pos 0 string "" & info []
~docv:"directory to index") in
Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir),
Term.info "recent" ~doc:"list recent texts" ~man:[ `S "DESCRIPTION";
`P "List header information of most recent texts. If -R is used, list header
information for texts found in subdirectories too, along with their filepaths" ]
open Cmdliner
let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories")
let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order")
let paths = Arg.(value & flag & info ["p"] ~doc: "Show file paths")
let number = Arg.(value & opt (some int) (Some 10) & 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 dir = Arg.(value & pos 0 string "" & info [] ~docv: "Directory to index")
let recent_t = Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir)
let cmd =
let doc = "List recent texts" in
let man = [
`S Manpage.s_description;
`P "List header information of most recent texts.";
`P "If -R is used, list header information for texts found in subdirectories, too, along with their filepaths" ]
in
let info = Cmd.info "recent" ~version:"%%VERSION%%" ~doc ~man in
Cmd.v info recent_t