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:
42
cli/index.ml
42
cli/index.ml
@@ -67,25 +67,25 @@ let load dir =
|
||||
let index_path = Filename.concat dir "index.pck" in
|
||||
index { dir; index_path; pck = Header_pack.of_kv kv }
|
||||
|
||||
open Ocmd
|
||||
let term =
|
||||
let print= Arg.(value & flag & info ["print"] ~doc:"print info") in
|
||||
let title= Arg.(value & opt ~vopt:(Some "") (some string) None & info ["t"; "title"]
|
||||
~docv:"string" ~doc:"Title for index") in
|
||||
let auth = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["a"; "authors"]
|
||||
~docv:"comma-separated names" ~doc:"Index authors") in
|
||||
let locs = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["l"; "locations"]
|
||||
~docv:"comma-separated URLs" ~doc:"repository URLs") in
|
||||
let peers= Arg.(value & opt ~vopt:(Some "") (some string) None & info ["p"; "peers"]
|
||||
~docv:"comma-separated URLs" ~doc:"URLs to other known text repositories") in
|
||||
let dir = Arg.(value & pos 0 string "." & info []
|
||||
~docv:"directory to index") in
|
||||
let doc = "Generate an index.pck for texts in a directory" in
|
||||
Term.(const load $ dir $ print $ title $ auth $ locs $ peers),
|
||||
Term.info "index" ~doc
|
||||
~man:[ `S "DESCRIPTION"; `Pre "An index contains:\n
|
||||
* an info section with: title for the index, the authors, locations (URLs) the texts can be access\n
|
||||
* listing of texts with: ID, date, title, authors, topics\n
|
||||
* list of other text repositories (peers)\n\n
|
||||
MessagePack format. <msgpack.org>" ]
|
||||
open Cmdliner
|
||||
let print = Arg.(value & flag & info ["print"] ~doc: "Print info")
|
||||
let title = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["t"; "title"] ~docv: "string" ~doc: "Title for index")
|
||||
let auth = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["a"; "authors"] ~docv: "Comma-separated names" ~doc: "Index authors")
|
||||
let locs = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["l"; "location"] ~docv: "Comma-separated URLs" ~doc: "Repository URLs")
|
||||
let peers = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["p"; "peers"] ~docv: "Comma-separated URLs" ~doc: "URLs to other known text repositories")
|
||||
let dir = Arg.(value & pos 0 string "." & info [] ~docv: "Directory to index")
|
||||
|
||||
let index_t = Term.(const load $ dir $ print $ title $ auth $ locs $ peers)
|
||||
|
||||
let cmd =
|
||||
let doc = "Generate an index.pck for texts in a directory" in
|
||||
let man = [
|
||||
`S Manpage.s_description;
|
||||
`P "An index contains:\n";
|
||||
`P "* n info section with: title for the index, the authors, locations (URLs) the texts can be accessed.";
|
||||
`P "* listing of texts with: ID, date, title, authors, topics.";
|
||||
`P "* list of other text repositories (peers)";
|
||||
`S Manpage.s_see_also;
|
||||
`P "MessagePack format. https://msgpack.org" ] in
|
||||
let info = Cmd.info "index" ~version:"%%VERSION%%" ~doc ~man in
|
||||
Cmd.v info index_t
|
||||
|
||||
Reference in New Issue
Block a user