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

    r65 r66  
    11open Logarion
    2 open Ocmd
     2open Cmdliner
    33
    44let new_txt title topics_opt interactive =
     
    1414                print_endline filepath
    1515
    16 let term =
    17         let title = Arg.(value & pos 0 string "" & info []
    18                 ~docv:"title" ~doc:"Title for new article") in
    19         let topics= Arg.(value & opt (some string) None & info ["t"; "topics"]
    20                 ~docv:"comma-separated topics" ~doc:"Topics for new article") in
    21         let inter = Arg.(value & flag & info ["i"; "interactive"]
    22                 ~doc:"Prompts through the steps of creation") in
    23         Term.(const new_txt $ title $ topics $ inter), Term.info "new"
    24                 ~doc:"create a new article" ~man:[ `S "DESCRIPTION";
    25                 `P "Create a new article, with title 'Draft' when none provided"]
     16let title = Arg.(value & pos 0 string "" & info [] ~docv: "title" ~doc: "Title for new article")
     17let topics = Arg.(value & opt (some string) None & info ["t"; "topics"] ~docv: "Comma-separated topics" ~doc: "Topics for new article")
     18let inter = Arg.(value & flag & info ["i"; "interactive"] ~doc: "Prompt through the steps of creation")
     19
     20let new_t = Term.(const new_txt $ title $ topics $ inter)
     21
     22let cmd =
     23  let doc = "Create a new article" in
     24  let man = [
     25      `S Manpage.s_description;
     26      `P "Create a new article, with title 'Draft' when none provided" ]
     27  in
     28  let info = Cmd.info "new" ~version:"%%VERSION%%" ~doc ~man in
     29  Cmd.v info new_t
Note: See TracChangeset for help on using the changeset viewer.