···5566(* Use to test for completion interactively. *)
7788-let tool ~file ~dir ~path ~choice =
88+let tool ~file ~dir ~path ~choice ~cmd =
99 print_endline "Happy?";
1010 Cmdliner.Cmd.Exit.ok
1111···2424 let doc = "Use me to test for path completion." in
2525 Arg.(value & opt (some path) None & info ["path"] ~doc)
2626 and+ choice =
2727- let doc = "Use me to test for enum completion for short and long options." in
2727+ let doc =
2828+ "Use me to test for enum completion for short and long options."
2929+ in
2830 Arg.(value & opt (enum ["one", `One; "two", `Two; "three", `Three]) `One
2931 & info ["choice"; "c"] ~doc)
3232+ and+ cmd =
3333+ let arg_conv =
3434+ let completion = Arg.Completion.complete_restart in
3535+ Arg.Conv.of_conv ~completion Arg.string
3636+ in
3737+ let doc =
3838+ "Use me to test for completion restart of other tools after \
3939+ the $(b,--) token"
4040+ in
4141+ Arg.(value & pos_all arg_conv [] & info [] ~doc ~docv:"ARG")
3042 in
3131- tool ~file ~dir ~path ~choice
4343+ tool ~file ~dir ~path ~choice ~cmd
32443345let main () = Cmd.eval' cmd
3446let () = if !Sys.interactive then () else exit (main ())