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:
26
cli/new.ml
26
cli/new.ml
@@ -1,5 +1,5 @@
|
||||
open Logarion
|
||||
open Ocmd
|
||||
open Cmdliner
|
||||
|
||||
let new_txt title topics_opt interactive =
|
||||
let kv = Logarion.File_store.of_kv_file () in
|
||||
@@ -13,13 +13,17 @@ let new_txt title topics_opt interactive =
|
||||
if interactive then (Sys.command ("$EDITOR " ^ filepath) |> ignore);
|
||||
print_endline filepath
|
||||
|
||||
let term =
|
||||
let title = Arg.(value & pos 0 string "" & info []
|
||||
~docv:"title" ~doc:"Title for new article") in
|
||||
let topics= Arg.(value & opt (some string) None & info ["t"; "topics"]
|
||||
~docv:"comma-separated topics" ~doc:"Topics for new article") in
|
||||
let inter = Arg.(value & flag & info ["i"; "interactive"]
|
||||
~doc:"Prompts through the steps of creation") in
|
||||
Term.(const new_txt $ title $ topics $ inter), Term.info "new"
|
||||
~doc:"create a new article" ~man:[ `S "DESCRIPTION";
|
||||
`P "Create a new article, with title 'Draft' when none provided"]
|
||||
let title = Arg.(value & pos 0 string "" & info [] ~docv: "title" ~doc: "Title for new article")
|
||||
let topics = Arg.(value & opt (some string) None & info ["t"; "topics"] ~docv: "Comma-separated topics" ~doc: "Topics for new article")
|
||||
let inter = Arg.(value & flag & info ["i"; "interactive"] ~doc: "Prompt through the steps of creation")
|
||||
|
||||
let new_t = Term.(const new_txt $ title $ topics $ inter)
|
||||
|
||||
let cmd =
|
||||
let doc = "Create a new article" in
|
||||
let man = [
|
||||
`S Manpage.s_description;
|
||||
`P "Create a new article, with title 'Draft' when none provided" ]
|
||||
in
|
||||
let info = Cmd.info "new" ~version:"%%VERSION%%" ~doc ~man in
|
||||
Cmd.v info new_t
|
||||
|
||||
Reference in New Issue
Block a user