File: test_with_used_args.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 (18 lines) | stat: -rw-r--r-- 612 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open Cmdliner

let print_args ((), args) _other =
  print_endline (String.concat " " args)

let test_pos_left =
  let a = Arg.(value & flag & info ["a"; "aaa"]) in
  let b = Arg.(value & opt (some string) None & info ["b"; "bbb"]) in
  let c = Arg.(value & pos_all string [] & info []) in
  let main =
    let ignore_values _a _b _c = () in
    Term.(with_used_args (const ignore_values $ a $ b $ c))
  in
  let other = Arg.(value & flag & info ["other"]) in
  let info = Cmd.info "test_capture" ~doc:"Test pos left" in
  Cmd.v info Term.(const print_args $ main $ other)

let () = exit (Cmd.eval test_pos_left)