Changeset 66 in code for trunk/cli/recent.ml


Ignore:
Timestamp:
Aug 21, 2024, 1:37:05 AM (8 months ago)
Author:
yakumo.izuru
Message:

Migrate the codebase to the latest revision of Cmdliner

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/recent.ml

    r65 r66  
    33module A = Archive
    44
    5 open Ocmd
    6 let term =
    7         let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in
    8         let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in
    9         let paths = Arg.(value & flag & info ["p"] ~doc:"show file paths") in
    10         let number = Arg.(value & opt (some int) (Some 10) & info ["n"]
    11                 ~docv:"number" ~doc:"number of entries to list") in
    12         let authed = Arg.(value & opt (some string) None & info ["authored"]
    13                 ~docv:"comma-separated names" ~doc:"texts by authors") in
    14         let topics = Arg.(value & opt (some string) None & info ["topics"]
    15                 ~docv:"comma-separated topics" ~doc:"texts with topics") in
    16         let dir  = Arg.(value & pos 0 string "" & info []
    17                 ~docv:"directory to index") in
    18         Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir),
    19         Term.info "recent" ~doc:"list recent texts" ~man:[ `S "DESCRIPTION";
    20                 `P "List header information of most recent texts. If -R is used, list header
    21                 information for texts found in subdirectories too, along with their filepaths" ]
     5open Cmdliner
     6let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories")
     7let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order")
     8let paths = Arg.(value & flag & info ["p"] ~doc: "Show file paths")
     9let number = Arg.(value & opt (some int) (Some 10) & info ["n"] ~docv: "number" ~doc: "Number of entries to list")
     10let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated names" ~doc: "Texts by authors")
     11let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv: "Comma-separated topics" ~doc: "Texts with topics")
     12let dir = Arg.(value & pos 0 string "" & info [] ~docv: "Directory to index")
     13
     14let recent_t = Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir)
     15let cmd =
     16  let doc = "List recent texts" in
     17  let man = [
     18      `S Manpage.s_description;
     19      `P "List header information of most recent texts.";
     20      `P "If -R is used, list header information for texts found in subdirectories, too, along with their filepaths" ]
     21  in
     22  let info = Cmd.info "recent" ~version:"%%VERSION%%" ~doc ~man in
     23  Cmd.v info recent_t
Note: See TracChangeset for help on using the changeset viewer.