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

@@ -76,15 +76,21 @@ let at_path types noindex path = match path with
)
| path -> Printf.eprintf "Path doesn't exist: %s" path
open Ocmd
let term =
let 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)") in
let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type"
~doc:"Convert to file type") in
let noindex = Arg.(value & flag & info ["noindex"]
~doc:"Don't create indices in target format") in
Term.(const at_path $ types $ noindex $ path),
Term.info "convert" ~doc:"convert texts"
~man:[ `S "DESCRIPTION"; `P "Convert text or indexed texts within a directory to another format.
If path is a directory must contain an index.pck. Run `txt index` first." ]
open Cmdliner
let 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)")
let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type" ~doc:"Convert to file type")
let noindex = Arg.(value & flag & info ["noindex"] ~doc:"Don't create indices in target format")
let convert_t = Term.(const at_path $ types $ noindex $ path)
let cmd =
let doc = "Convert texts" in
let man = [
`S Manpage.s_description;
`P "Convert text or indexed texts within a directory to another format.";
`P "If path is a directory must contain an index.pck.";
`P "Run `txt index` first." ]
in
let info = Cmd.info "convert" ~version: "%%VERSION%%" ~doc ~man in
Cmd.v info convert_t