File: test_pos_req.ml

package info (click to toggle)
cmdliner 1.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 512 kB
  • sloc: ml: 3,659; makefile: 59
file content (15 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
open Cmdliner

let pos r a1 a0 a2  =
  print_endline (String.concat "\n" ([a0; a1; a2; "--"] @ r))

let test_pos =
  let req p =
    let docv = Printf.sprintf "ARG%d" p in
    Arg.(required & pos p (some string) None & info [] ~docv)
  in
  let right = Arg.(non_empty & pos_right 2 string [] & info [] ~docv:"RIGHT") in
  let info = Cmd.info "test_pos_req" ~doc:"Test pos req arguments" in
  Cmd.v info Term.(const pos $ right $ req 1 $ req 0 $ req 2)

let () = exit (Cmd.eval test_pos)