diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c97faf..5e0858b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: opam-repositories: | default: https://github.com/ocaml/opam-repository.git mbarbin: https://github.com/mbarbin/opam-repository.git - # alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git + alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git # janestreet-bleeding: https://github.com/janestreet/opam-repository.git # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages diff --git a/.github/workflows/deploy-doc.yml b/.github/workflows/deploy-doc.yml index d9ccc74..129e68f 100644 --- a/.github/workflows/deploy-doc.yml +++ b/.github/workflows/deploy-doc.yml @@ -42,7 +42,7 @@ jobs: opam-repositories: | default: https://github.com/ocaml/opam-repository.git mbarbin: https://github.com/mbarbin/opam-repository.git - # alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git + alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git # janestreet-bleeding: https://github.com/janestreet/opam-repository.git # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages diff --git a/.github/workflows/test-deploy-doc.yml b/.github/workflows/test-deploy-doc.yml index 15a939a..97e1518 100644 --- a/.github/workflows/test-deploy-doc.yml +++ b/.github/workflows/test-deploy-doc.yml @@ -42,7 +42,7 @@ jobs: opam-repositories: | default: https://github.com/ocaml/opam-repository.git mbarbin: https://github.com/mbarbin/opam-repository.git - # alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git + alpha: https://github.com/kit-ty-kate/opam-alpha-repository.git # janestreet-bleeding: https://github.com/janestreet/opam-repository.git # janestreet-bleeding-external: https://github.com/janestreet/opam-repository.git#external-packages diff --git a/CHANGES.md b/CHANGES.md index ac14815..da9b547 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +## Unreleased + +### Changed + +- Require `cmdliner >= 2.1.1` for test packages (@mbarbin). +- `cmdlang-to-cmdliner` still targets `cmdliner >= 1.3.0` for broad compatibility, but is no longer tested against versions older than 2.1.1 (@mbarbin). +- Migrated expect and cram tests to `cmdliner.2.1.1`'s revised error/help output (@mbarbin). +- Force `NO_COLOR=1` in the dev build environment so `cmdliner`'s ANSI-styled error and help output doesn't leak into expected traces (@mbarbin). + ## 0.0.11 (2026-05-08) ### Added diff --git a/cmdlang-dev.opam b/cmdlang-dev.opam index 49791ef..9386c5c 100644 --- a/cmdlang-dev.opam +++ b/cmdlang-dev.opam @@ -18,7 +18,7 @@ depends: [ "cmdlang-to-base" {= version} "cmdlang-to-climate" {= version} "cmdlang-to-cmdliner" {= version} - "cmdliner" {>= "1.3.0" & < "2.0"} + "cmdliner" {>= "2.1.1"} "conf-jq" "dune-build-info" {>= "3.17"} "mdx" {>= "2.4"} diff --git a/cmdlang-tests.opam b/cmdlang-tests.opam index 3a97806..10be710 100644 --- a/cmdlang-tests.opam +++ b/cmdlang-tests.opam @@ -17,7 +17,7 @@ depends: [ "cmdlang-to-base" {= version} "cmdlang-to-climate" {= version} "cmdlang-to-cmdliner" {= version} - "cmdliner" {>= "1.3.0" & < "2.0"} + "cmdliner" {>= "2.1.1"} "core" {>= "v0.17"} "core_unix" {>= "v0.17"} "dune-build-info" {>= "3.17"} diff --git a/cmdlang-to-cmdliner.opam b/cmdlang-to-cmdliner.opam index c0ab9d6..64c67c9 100644 --- a/cmdlang-to-cmdliner.opam +++ b/cmdlang-to-cmdliner.opam @@ -35,6 +35,12 @@ description: """\ specified with [cmdlang] into [cmdliner] commands suitable for execution. +This library aims to remain as compatible as possible with older +versions of [cmdliner], down to [1.3]. However, it is only actively +tested against the version of [cmdliner] used by this project's own +test suite (currently [>= 2.1.1]), so older versions are no longer +verified by CI. + [cmdliner]: https://github.com/dbuenzli/cmdliner """ diff --git a/cmdlang-to-cmdliner.opam.template b/cmdlang-to-cmdliner.opam.template index 5129cf7..9d2800c 100644 --- a/cmdlang-to-cmdliner.opam.template +++ b/cmdlang-to-cmdliner.opam.template @@ -4,6 +4,12 @@ description: """\ specified with [cmdlang] into [cmdliner] commands suitable for execution. +This library aims to remain as compatible as possible with older +versions of [cmdliner], down to [1.3]. However, it is only actively +tested against the version of [cmdliner] used by this project's own +test suite (currently [>= 2.1.1]), so older versions are no longer +verified by CI. + [cmdliner]: https://github.com/dbuenzli/cmdliner """ diff --git a/doc/docs/tutorials/getting-started/README.md b/doc/docs/tutorials/getting-started/README.md index f54b838..ab1a82e 100644 --- a/doc/docs/tutorials/getting-started/README.md +++ b/doc/docs/tutorials/getting-started/README.md @@ -264,7 +264,7 @@ NAME my-calculator - A simple calculator. SYNOPSIS - my-calculator [--op=OP] [--verbose] [OPTION]… a b + my-calculator --op=OP [--verbose] [OPTION]… a b ARGUMENTS a (required) @@ -308,19 +308,17 @@ Additionally, we don't need to worry about handling invalid usages, this is done ```sh $ ./my-calculator --op=not-found 1 2.5 +Usage: my-calculator [--help] --op=OP [--verbose] [OPTION]… a b my-calculator: option '--op': invalid value 'not-found', expected either 'add' or 'mul' -Usage: my-calculator [--op=OP] [--verbose] [OPTION]… a b -Try 'my-calculator --help' for more information. [124] ``` ```sh $ ./my-calculator --op=add true 2.5 +Usage: my-calculator [--help] --op=OP [--verbose] [OPTION]… a b my-calculator: a argument: invalid value 'true', expected a floating point number -Usage: my-calculator [--op=OP] [--verbose] [OPTION]… a b -Try 'my-calculator --help' for more information. [124] ``` diff --git a/dune b/dune index 92e4d5b..8107a99 100644 --- a/dune +++ b/dune @@ -1,4 +1,9 @@ (env (dev (odoc - (warnings fatal)))) + (warnings fatal)) + ;; Since cmdliner 2.0, error and help messages use ANSI-styled. This makes our + ;; expect and cram tests depend on the ambient environment of whoever runs + ;; them. Force plain output so corrected files are stable across environments. + (env-vars + (NO_COLOR "1")))) diff --git a/dune-project b/dune-project index f501be7..b15a3c0 100644 --- a/dune-project +++ b/dune-project @@ -101,9 +101,7 @@ (cmdlang-to-cmdliner (= :version)) (cmdliner - (and - (>= 1.3.0) - (< 2.0))) + (>= 2.1.1)) (core (>= v0.17)) (core_unix @@ -159,9 +157,7 @@ (cmdlang-to-cmdliner (= :version)) (cmdliner - (and - (>= 1.3.0) - (< 2.0))) + (>= 2.1.1)) conf-jq (dune-build-info (>= 3.17)) diff --git a/src/cmdlang-to-cmdliner/translate.mli b/src/cmdlang-to-cmdliner/translate.mli index e88f720..1bc9154 100644 --- a/src/cmdlang-to-cmdliner/translate.mli +++ b/src/cmdlang-to-cmdliner/translate.mli @@ -4,7 +4,13 @@ (*_ SPDX-License-Identifier: MIT *) (*_********************************************************************************) -(** Translate cmdlang parsers to cmdliner. *) +(** Translate cmdlang parsers to cmdliner. + + This library aims to remain as compatible as possible with older + versions of [cmdliner], down to [1.3]. However, it is only actively + tested against the version of [cmdliner] used by this project's own test + suite (currently [>= 2.1.1]), so older versions are no longer verified + by CI. *) (** {1 Param} *) diff --git a/test/cram/basic.t b/test/cram/basic.t index 40b3aa7..c9a688e 100644 --- a/test/cram/basic.t +++ b/test/cram/basic.t @@ -190,9 +190,8 @@ flags. [124] $ ./main_cmdliner.exe basic int -13 - ./main_cmdliner.exe: unknown option '-1'. - Usage: ./main_cmdliner.exe basic int [OPTION]… INT - Try './main_cmdliner.exe basic int --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe basic int [--help] [OPTION]… INT + ./main_cmdliner.exe: unknown option '-1' [124] $ ./main_stdlib_runner.exe basic int -13 @@ -315,9 +314,8 @@ flags. [124] $ ./main_cmdliner.exe basic float -13.8 - ./main_cmdliner.exe: unknown option '-1'. - Usage: ./main_cmdliner.exe basic float [OPTION]… FLOAT - Try './main_cmdliner.exe basic float --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe basic float [--help] [OPTION]… FLOAT + ./main_cmdliner.exe: unknown option '-1' [124] $ ./main_stdlib_runner.exe basic float -13.8 @@ -454,10 +452,9 @@ And run it too. [124] $ ./main_cmdliner.exe basic bool True - ./main_cmdliner.exe: BOOL argument: invalid value 'True', either 'true' or - 'false' - Usage: ./main_cmdliner.exe basic bool [OPTION]… BOOL - Try './main_cmdliner.exe basic bool --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe basic bool [--help] [OPTION]… BOOL + ./main_cmdliner.exe: BOOL argument: invalid value 'True', expected either + 'true' or 'false' [124] $ ./main_stdlib_runner.exe basic bool True @@ -497,10 +494,9 @@ Invalid entry. [124] $ ./main_cmdliner.exe basic bool Not_a_bool - ./main_cmdliner.exe: BOOL argument: invalid value 'Not_a_bool', either 'true' - or 'false' - Usage: ./main_cmdliner.exe basic bool [OPTION]… BOOL - Try './main_cmdliner.exe basic bool --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe basic bool [--help] [OPTION]… BOOL + ./main_cmdliner.exe: BOOL argument: invalid value 'Not_a_bool', expected + either 'true' or 'false' [124] $ ./main_stdlib_runner.exe basic bool Not_a_bool @@ -595,9 +591,8 @@ And run it too. foo.txt $ ./main_cmdliner.exe basic file foo.txt + Usage: ./main_cmdliner.exe basic file [--help] [OPTION]… FILE ./main_cmdliner.exe: FILE argument: no 'foo.txt' file or directory - Usage: ./main_cmdliner.exe basic file [OPTION]… FILE - Try './main_cmdliner.exe basic file --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe basic file foo.txt @@ -631,9 +626,8 @@ Same when the file actually exists /bogus/bar $ ./main_cmdliner.exe basic file /bogus/bar + Usage: ./main_cmdliner.exe basic file [--help] [OPTION]… FILE ./main_cmdliner.exe: FILE argument: no '/bogus/bar' file or directory - Usage: ./main_cmdliner.exe basic file [OPTION]… FILE - Try './main_cmdliner.exe basic file --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe basic file /bogus/bar diff --git a/test/cram/enum.t b/test/cram/enum.t index 9a32ad0..2124a61 100644 --- a/test/cram/enum.t +++ b/test/cram/enum.t @@ -138,10 +138,9 @@ Cmdliner. red $ ./main_cmdliner.exe enum pos INVALID + Usage: ./main_cmdliner.exe enum pos [--help] [OPTION]… COLOR ./main_cmdliner.exe: COLOR argument: invalid value 'INVALID', expected one of 'red', 'green' or 'blue' - Usage: ./main_cmdliner.exe enum pos [OPTION]… COLOR - Try './main_cmdliner.exe enum pos --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_cmdliner.exe enum named --help=plain @@ -149,7 +148,7 @@ Cmdliner. ./main_cmdliner.exe-enum-named - Print color. SYNOPSIS - ./main_cmdliner.exe enum named [--color=COLOR] [OPTION]… + ./main_cmdliner.exe enum named --color=COLOR [OPTION]… OPTIONS --color=COLOR (required) @@ -183,10 +182,9 @@ Cmdliner. red $ ./main_cmdliner.exe enum named --color INVALID + Usage: ./main_cmdliner.exe enum named [--help] --color=COLOR [OPTION]… ./main_cmdliner.exe: option '--color': invalid value 'INVALID', expected one of 'red', 'green' or 'blue' - Usage: ./main_cmdliner.exe enum named [--color=COLOR] [OPTION]… - Try './main_cmdliner.exe enum named --help' or './main_cmdliner.exe --help' for more information. [124] Stdlib runner. diff --git a/test/cram/group.t b/test/cram/group.t index d4395b4..5d27324 100644 --- a/test/cram/group.t +++ b/test/cram/group.t @@ -133,9 +133,9 @@ What happens when that group is run: [1] $ ./main_cmdliner.exe basic - ./main_cmdliner.exe: required COMMAND name is missing, must be one of 'bool', 'file', 'float', 'int' or 'string'. - Usage: ./main_cmdliner.exe basic COMMAND … - Try './main_cmdliner.exe basic --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe basic [--help] COMMAND … + ./main_cmdliner.exe: required COMMAND name is missing, must be one of 'bool', + 'file', 'float', 'int' or 'string' [124] $ ./main_stdlib_runner.exe basic @@ -266,9 +266,8 @@ What happens when that group with a default is run: [124] $ ./main_cmdliner.exe group + Usage: ./main_cmdliner.exe group [--help] [COMMAND] … ./main_cmdliner.exe: required argument STRING is missing - Usage: ./main_cmdliner.exe group [COMMAND] … - Try './main_cmdliner.exe group --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe group @@ -299,9 +298,8 @@ With cmdliner, this particular default command is not supported because the positional argument is interpreted as an unknown command: $ ./main_cmdliner.exe group World - ./main_cmdliner.exe: unknown command 'World', must be 'a'. - Usage: ./main_cmdliner.exe group [COMMAND] … - Try './main_cmdliner.exe group --help' or './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe group [--help] [COMMAND] … + ./main_cmdliner.exe: unknown command 'World'. Must be 'a' [124] The recommended way to handle this in cmdliner is to add the special '--' token, such as in: @@ -345,9 +343,9 @@ default, when it is invoked with an invalid subcommand name. [124] $ ./main_cmdliner.exe invalid - ./main_cmdliner.exe: unknown command 'invalid', must be one of 'basic', 'doc', 'enum', 'flags', 'group', 'named' or 'return'. - Usage: ./main_cmdliner.exe COMMAND … - Try './main_cmdliner.exe --help' for more information. + Usage: ./main_cmdliner.exe [--help] COMMAND … + ./main_cmdliner.exe: unknown command 'invalid'. Must be one of 'basic', + 'doc', 'enum', 'flags', 'group', 'named' or 'return' [124] $ ./main_stdlib_runner.exe invalid diff --git a/test/cram/named-with-default.t b/test/cram/named-with-default.t index 4fe65c4..28c7aff 100644 --- a/test/cram/named-with-default.t +++ b/test/cram/named-with-default.t @@ -217,9 +217,9 @@ functions or parsers generated from modules with utils. [124] $ ./main_cmdliner.exe named with-default create --who=C + Usage: ./main_cmdliner.exe named with-default create [--help] [--who=(A|B)] + [OPTION]… ./main_cmdliner.exe: option '--who': "C": invalid E.t - Usage: ./main_cmdliner.exe named with-default create [--who=(A|B)] [OPTION]… - Try './main_cmdliner.exe named with-default create --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe named with-default create --who C @@ -330,11 +330,11 @@ Named-with-default with a stringable parameter. Named_with_default__stringable SYNOPSIS - ./main_cmdliner.exe named with-default stringable [--who=VAL] + ./main_cmdliner.exe named with-default stringable [--who=VALUE] [OPTION]… OPTIONS - --who=VAL (absent=my-id) + --who=VALUE (absent=my-id) identifier. COMMON OPTIONS @@ -413,10 +413,10 @@ Named-with-default with a validated string parameter. Named_with_default__validated SYNOPSIS - ./main_cmdliner.exe named with-default validated [--who=VAL] [OPTION]… + ./main_cmdliner.exe named with-default validated [--who=VALUE] [OPTION]… OPTIONS - --who=VAL (absent=0000) + --who=VALUE (absent=0000) 4 letters alphanumerical identifier. COMMON OPTIONS @@ -490,10 +490,10 @@ Invalid entry for the validated string parameter. [124] $ ./main_cmdliner.exe named with-default validated --who foo + Usage: ./main_cmdliner.exe named with-default validated [--help] + [--who=VALUE] [OPTION]… ./main_cmdliner.exe: option '--who': "foo": invalid 4 letters alphanumerical identifier - Usage: ./main_cmdliner.exe named with-default validated [--who=VAL] [OPTION]… - Try './main_cmdliner.exe named with-default validated --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe named with-default validated --who foo @@ -614,9 +614,9 @@ Named-with-default with a comma-separated string parameter. [124] $ ./main_cmdliner.exe named with-default pos-int -x blah + Usage: ./main_cmdliner.exe named with-default pos-int [--help] [-x X] + [OPTION]… ./main_cmdliner.exe: option '-x': Not an int - Usage: ./main_cmdliner.exe named with-default pos-int [-x X] [OPTION]… - Try './main_cmdliner.exe named with-default pos-int --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe named with-default pos-int -x blah @@ -652,9 +652,9 @@ Named-with-default with a comma-separated string parameter. [124] $ ./main_cmdliner.exe named with-default pos-int -x 0 + Usage: ./main_cmdliner.exe named with-default pos-int [--help] [-x X] + [OPTION]… ./main_cmdliner.exe: option '-x': Strictly positive int expected - Usage: ./main_cmdliner.exe named with-default pos-int [-x X] [OPTION]… - Try './main_cmdliner.exe named with-default pos-int --help' or './main_cmdliner.exe --help' for more information. [124] $ ./main_stdlib_runner.exe named with-default pos-int -x 0 diff --git a/test/expect/test__flag.ml b/test/expect/test__flag.ml index 7594cf7..92403e7 100644 --- a/test/expect/test__flag.ml +++ b/test/expect/test__flag.ml @@ -47,9 +47,8 @@ let%expect_test "flag" = -h, --help Show this help message. Unknown argument name: -p ----------------------------------------------------- Cmdliner - test: unknown option '-p'. - Usage: test [--print-hello] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [--print-hello] [OPTION]… + test: unknown option '-p' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -81,9 +80,8 @@ let%expect_test "flag" = -h, --help Show this help message. Unknown argument name: -p ----------------------------------------------------- Cmdliner - test: unknown option '-p', did you mean '--print-hello'? - Usage: test [--print-hello] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [--print-hello] [OPTION]… + test: unknown option '-p'. Did you mean '--print-hello'? ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -100,9 +98,9 @@ let%expect_test "flag" = --help Display this list of options ("Evaluation Failed" ((exit_code 2))) |}]; - (* Partial flags are handled differently by the backends. In [climate], they - are rejected. In [cmdliner] and [core.command], prefixes are interpreted as - full flags. We say more about this in a dedicated section below. *) + (* Partial flags are handled differently by the backends. In [core.command], + prefixes are interpreted as full flags. In the other backends, they are + rejected. We say more about this in a dedicated section below. *) Arg_test.eval_all test { prog = "test"; args = [ "--print" ] }; [%expect {| @@ -114,7 +112,9 @@ let%expect_test "flag" = -h, --help Show this help message. Unknown argument name: --print ----------------------------------------------------- Cmdliner - Hello + Usage: test [--help] [--print-hello] [OPTION]… + test: unknown option '--print' + ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command Hello ----------------------------------------------------- Stdlib_runner @@ -173,9 +173,8 @@ let%expect_test "1-letter-flag" = -h, --help Show this help message. Single-character names must only be specified with a single dash. "--p" is not allowed as it has two dashes but only one character. ----------------------------------------------------- Cmdliner - test: unknown option '--p', did you mean '-p'? - Usage: test [-p] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [-p] [OPTION]… + test: unknown option '--p'. Did you mean '-p'? ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -238,10 +237,10 @@ let%expect_test "1-letter-alias" = ----------------------------------------------------- Stdlib_runner Hello |}]; - (* One letter flags may not be called with 2 dashes. However, since [cmdliner] - and [core.command] allow partial flags, if the one letter is actually the - prefix of a long flag name, the two dashes form will be accepted by these - two backend. Beware, this may be confusing. *) + (* One letter flags may not be called with 2 dashes. However, since [core.command] + allow partial flags, if the one letter is actually the prefix of a long + flag name, the two dashes form will be accepted by this backend. Beware, + this may be confusing. *) Arg_test.eval_all test { prog = "test"; args = [ "--p" ] }; [%expect {| @@ -253,7 +252,9 @@ let%expect_test "1-letter-alias" = -h, --help Show this help message. Single-character names must only be specified with a single dash. "--p" is not allowed as it has two dashes but only one character. ----------------------------------------------------- Cmdliner - Hello + Usage: test [--help] [--print-hello] [OPTION]… + test: unknown option '--p'. Did you mean '-p'? + ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command Hello ----------------------------------------------------- Stdlib_runner @@ -315,8 +316,8 @@ let%expect_test "ambiguous prefixes" = ----------------------------------------------------- Stdlib_runner Hello World |}]; - (* When the flags are supplied partially, the backend diverge. If the - prefix is non-ambiguous, [cmdliner] and [core.command] accept it. *) + (* When the flags are supplied partially, the backend diverge. If the prefix is + non-ambiguous, [core.command] accept it. *) Arg_test.eval_all test { prog = "test"; args = [ "--print-hello-w" ] }; [%expect {| @@ -329,7 +330,9 @@ let%expect_test "ambiguous prefixes" = -h, --help Show this help message. Unknown argument name: --print-hello-w ----------------------------------------------------- Cmdliner - Hello World + Usage: test [--help] [--print-hello-world] [--print-hello-you] [OPTION]… + test: unknown option '--print-hello-w' + ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command Hello World ----------------------------------------------------- Stdlib_runner @@ -358,9 +361,8 @@ let%expect_test "ambiguous prefixes" = -h, --help Show this help message. Unknown argument name: --print-hello ----------------------------------------------------- Cmdliner - test: option '--print-hello' ambiguous and could be either '--print-hello-world' or '--print-hello-you' - Usage: test [--print-hello-world] [--print-hello-you] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [--print-hello-world] [--print-hello-you] [OPTION]… + test: unknown option '--print-hello' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -439,9 +441,8 @@ let%expect_test "user provided dashes" = Failure "Error in argument spec: Attempted to use \"-a\" as an argument name. \"-a\" is not a valid argument name because it begins with a dash which is not allowed.")) ----------------------------------------------------- Cmdliner - test: unknown option '-a'. - Usage: test [---a] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [---a] [OPTION]… + test: unknown option '-a' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -456,9 +457,8 @@ let%expect_test "user provided dashes" = Failure "Error in argument spec: Attempted to use \"--a\" as an argument name. \"--a\" is not a valid argument name because it begins with a dash which is not allowed.")) ----------------------------------------------------- Cmdliner - test: unknown option '--a', did you mean '----a'? - Usage: test [----a] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [----a] [OPTION]… + test: unknown option '--a'. Did you mean '----a'? ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -473,9 +473,8 @@ let%expect_test "user provided dashes" = Failure "Error in argument spec: Attempted to use \"-long\" as an argument name. \"-long\" is not a valid argument name because it begins with a dash which is not allowed.")) ----------------------------------------------------- Cmdliner - test: unknown option '-l', did you mean '---long'? - Usage: test [---long] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [---long] [OPTION]… + test: unknown option '-l'. Did you mean '---long'? ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -490,9 +489,8 @@ let%expect_test "user provided dashes" = Failure "Error in argument spec: Attempted to use \"--long\" as an argument name. \"--long\" is not a valid argument name because it begins with a dash which is not allowed.")) ----------------------------------------------------- Cmdliner - test: unknown option '--long', did you mean '----long'? - Usage: test [----long] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] [----long] [OPTION]… + test: unknown option '--long'. Did you mean '----long'? ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( diff --git a/test/expect/test__invalid_pos_opt.ml b/test/expect/test__invalid_pos_opt.ml index 42951e3..2d50f9a 100644 --- a/test/expect/test__invalid_pos_opt.ml +++ b/test/expect/test__invalid_pos_opt.ml @@ -44,9 +44,8 @@ let%expect_test "invalid_pos_sequence" = -h, --help Show this help message. Missing required positional argument at position 1. ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… [STRING] STRING test: required argument STRING is missing - Usage: test [OPTION]… [STRING] STRING - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" "missing anonymous argument: STRING") @@ -118,9 +117,8 @@ let%expect_test "cmdliner" = run [ "B" ]; [%expect {| + Usage: ./main.exe [--help] [OPTION]… [STRING] STRING ./main.exe: required argument STRING is missing - Usage: ./main.exe [OPTION]… [STRING] STRING - Try './main.exe --help' for more information. 124 |}]; () diff --git a/test/expect/test__named.ml b/test/expect/test__named.ml index d18fe21..7732c34 100644 --- a/test/expect/test__named.ml +++ b/test/expect/test__named.ml @@ -24,9 +24,8 @@ let%expect_test "named" = -h, --help Show this help message. Missing required named argument: --who ----------------------------------------------------- Cmdliner + Usage: test [--help] --who=WHO [OPTION]… test: required option --who is missing - Usage: test [--who=WHO] [OPTION]… - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" "missing required flag: --who") @@ -82,9 +81,8 @@ let%expect_test "1-letter-named" = -h, --help Show this help message. Missing required named argument: -w ----------------------------------------------------- Cmdliner + Usage: test [--help] -w WHO [OPTION]… test: required option -w is missing - Usage: test [-w WHO] [OPTION]… - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" "missing required flag: -w") diff --git a/test/expect/test__negative_int_args.ml b/test/expect/test__negative_int_args.ml index f14c5c2..c289526 100644 --- a/test/expect/test__negative_int_args.ml +++ b/test/expect/test__negative_int_args.ml @@ -59,9 +59,8 @@ let%expect_test "negative positional" = -h, --help Show this help message. Unknown argument name: -1 ----------------------------------------------------- Cmdliner - test: unknown option '-1'. - Usage: test [OPTION]… INT - Try 'test --help' for more information. + Usage: test [--help] [OPTION]… INT + test: unknown option '-1' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -128,9 +127,8 @@ let%expect_test "negative named" = ----------------------------------------------------- Climate negative ----------------------------------------------------- Cmdliner - test: unknown option '-1'. - Usage: test [-n INT] [OPTION]… - Try 'test --help' for more information. + Usage: test [--help] -n INT [OPTION]… + test: unknown option '-1' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command negative diff --git a/test/expect/test__param.ml b/test/expect/test__param.ml index 7c4479a..9aec3fb 100644 --- a/test/expect/test__param.ml +++ b/test/expect/test__param.ml @@ -57,9 +57,8 @@ let%expect_test "int" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid value: "not-an-int" (not an int) ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… INT test: INT argument: invalid value 'not-an-int', expected an integer - Usage: test [OPTION]… INT - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -120,10 +119,9 @@ let%expect_test "float" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid value: "not-an-number" (not an float) ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… FLOAT test: FLOAT argument: invalid value 'not-an-number', expected a floating point number - Usage: test [OPTION]… FLOAT - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -184,9 +182,9 @@ let%expect_test "bool" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid value: "not-a-bool" (not an bool) ----------------------------------------------------- Cmdliner - test: BOOL argument: invalid value 'not-a-bool', either 'true' or 'false' - Usage: test [OPTION]… BOOL - Try 'test --help' for more information. + Usage: test [--help] [OPTION]… BOOL + test: BOOL argument: invalid value 'not-a-bool', expected either 'true' or + 'false' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -222,9 +220,8 @@ let%expect_test "file" = ----------------------------------------------------- Climate foo.txt ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… FILE test: FILE argument: no 'foo.txt' file or directory - Usage: test [OPTION]… FILE - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command foo.txt @@ -297,9 +294,8 @@ let%expect_test "enumerated" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid value: "Not_an_e" (valid values are: A, B) ----------------------------------------------------- Cmdliner - test: invalid value 'Not_an_e', expected either 'A' or 'B' - Usage: test [OPTION]… ARG - Try 'test --help' for more information. + Usage: test [--help] [OPTION]… ENUM + test: ENUM argument: invalid value 'Not_an_e', expected either 'A' or 'B' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -421,9 +417,8 @@ let%expect_test "validated_string" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid id ----------------------------------------------------- Cmdliner - test: invalid id - Usage: test [OPTION]… ARG - Try 'test --help' for more information. + Usage: test [--help] [OPTION]… VALUE + test: VALUE argument: invalid id ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( @@ -546,10 +541,9 @@ let%expect_test "comma_separated" = -h, --help Show this help message. Failed to parse the argument at position 0: invalid value: "Not_an_e" (valid values are: A, B) ----------------------------------------------------- Cmdliner - test: invalid element in list ('Not_an_e'): invalid value 'Not_an_e', - expected either 'A' or 'B' - Usage: test [OPTION]… ARG - Try 'test --help' for more information. + Usage: test [--help] [OPTION]… ENUM[,…] + test: ENUM[,…] argument: invalid element in list ('Not_an_e'): invalid + value 'Not_an_e', expected either 'A' or 'B' ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" ( diff --git a/test/expect/test__pos.ml b/test/expect/test__pos.ml index dd428e8..80f988a 100644 --- a/test/expect/test__pos.ml +++ b/test/expect/test__pos.ml @@ -26,9 +26,8 @@ let%expect_test "pos" = -h, --help Show this help message. Missing required positional argument at position 0. ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… WHO test: required argument WHO is missing - Usage: test [OPTION]… WHO - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Evaluation Failed" "missing anonymous argument: WHO") @@ -69,9 +68,8 @@ let%expect_test "skipping-pos" = Failure "Error in argument spec: Attempted to declare a parser with a gap in its positional arguments. No parser would interpret the argument at position 0 but there is a parser for at least one argument at a higher position.")) ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… WHO test: required argument WHO is missing - Usage: test [OPTION]… WHO - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Translation Raised" ( @@ -93,9 +91,8 @@ let%expect_test "skipping-pos" = Failure "Error in argument spec: Attempted to declare a parser with a gap in its positional arguments. No parser would interpret the argument at position 0 but there is a parser for at least one argument at a higher position.")) ----------------------------------------------------- Cmdliner + Usage: test [--help] [OPTION]… WHO test: required argument WHO is missing - Usage: test [OPTION]… WHO - Try 'test --help' for more information. ("Evaluation Failed" ((exit_code 124))) ----------------------------------------------------- Core_command ("Translation Raised" (