Changeset 66 in code for trunk/cli/convert.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/convert.ml

    r65 r66  
    7777        | path -> Printf.eprintf "Path doesn't exist: %s" path
    7878
    79 open Ocmd
    80 let term =
    81         let path = Arg.(value & pos 0 string "" & info [] ~docv:"path"
    82                 ~doc:"Text file or directory to convert. If directory is provided, it must contain an index.pck (see: txt index)") in
    83         let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type"
    84                 ~doc:"Convert to file type") in
    85         let noindex = Arg.(value & flag & info ["noindex"]
    86                 ~doc:"Don't create indices in target format") in
    87         Term.(const at_path $ types $ noindex $ path),
    88         Term.info "convert" ~doc:"convert texts"
    89                 ~man:[ `S "DESCRIPTION"; `P "Convert text or indexed texts within a directory to another format.
    90                 If path is a directory must contain an index.pck. Run `txt index` first." ]
     79open Cmdliner
     80
     81let path = Arg.(value & pos 0 string "" & info [] ~docv:"path" ~doc:"Text file or directory to convert. If directory is provided, it must contain an index.pck (see: txt index)")
     82let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type" ~doc:"Convert to file type")
     83let noindex = Arg.(value & flag & info ["noindex"] ~doc:"Don't create indices in target format")
     84
     85let convert_t = Term.(const at_path $ types $ noindex $ path)
     86
     87let cmd =
     88  let doc = "Convert texts" in
     89  let man = [
     90      `S Manpage.s_description;
     91      `P "Convert text or indexed texts within a directory to another format.";
     92      `P "If path is a directory must contain an index.pck.";
     93      `P "Run `txt index` first." ]
     94  in
     95  let info = Cmd.info "convert" ~version: "%%VERSION%%" ~doc ~man in
     96  Cmd.v info convert_t
Note: See TracChangeset for help on using the changeset viewer.