···26262727let testing = `File ~/"test/testing_cmdliner.ml"
28282929+let test_shell = test ~/"test/test_shell.ml" ~run:false
2930let test_arg = test ~/"test/test_arg.ml" ~srcs:[testing] ~requires:[b0_std]
3031let test_cmd = test ~/"test/test_cmd.ml" ~srcs:[testing] ~requires:[b0_std]
3132let test_completion =
+4-1
vendor/opam/cmdliner/DEVEL.md
···18181919This replaces the generic completion function used by tool completion
2020scripts with the new definition. Trying to complete tools should now
2121-use the new definitions.
2121+use the new definitions. To test the file, directory and path completions
2222+you can also use this test (invoke with `--help`)
2323+2424+ b0 -- test_shell
22252326If you change completion scripts in [`src/tool`](src/tool) you must invoke:
2427
+30
vendor/opam/cmdliner/test/test_shell.ml
···11+(*---------------------------------------------------------------------------
22+ Copyright (c) 2025 The cmdliner programmers. All rights reserved.
33+ SPDX-License-Identifier: ISC
44+ ---------------------------------------------------------------------------*)
55+66+(* Use to test for completion interactively. *)
77+88+let tool ~file ~dir ~path =
99+ print_endline "Happy?";
1010+ Cmdliner.Cmd.Exit.ok
1111+1212+open Cmdliner
1313+open Cmdliner.Term.Syntax
1414+1515+let cmd =
1616+ Cmd.make (Cmd.info "test_shell" ~version:"%%VERSION%%") @@
1717+ let+ file =
1818+ let doc = "Use me to test for filepath completion." in
1919+ Arg.(value & opt (some filepath) None & info ["file"] ~doc)
2020+ and+ dir =
2121+ let doc = "Use me to test for dirpath completion." in
2222+ Arg.(value & opt (some dirpath) None & info ["dir"] ~doc)
2323+ and+ path =
2424+ let doc = "Use me to test for path completion." in
2525+ Arg.(value & opt (some path) None & info ["path"] ~doc)
2626+ in
2727+ tool ~file ~dir ~path
2828+2929+let main () = Cmd.eval' cmd
3030+let () = if !Sys.interactive then () else exit (main ())