From e8b08e7011c1f968d82d2325b1718cc4532e996a Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Mon, 5 Sep 2022 11:42:44 +0200 Subject: [PATCH] Update cmdliner to display full command name --- .../blackbox-tests/test-cases/cmdline/profile.t | 2 +- .../test-cases/cmdliner-dep-conf.t/run.t | 4 ++-- test/blackbox-tests/test-cases/describe.t | 8 ++++---- .../blackbox-tests/test-cases/dune-init.t/run.t | 13 +++++++------ .../test-cases/external-lib-deps.t | 2 +- test/blackbox-tests/test-cases/github3046.t | 17 +++++++++-------- test/blackbox-tests/test-cases/github3530.t | 4 ++-- test/blackbox-tests/test-cases/misc.t/run.t | 12 ++++++------ vendor/cmdliner/src/cmdliner.mli | 4 ++++ vendor/cmdliner/src/cmdliner_msg.ml | 5 ++++- vendor/update-cmdliner.sh | 2 +- 11 files changed, 41 insertions(+), 32 deletions(-) mode change 100755 => 100644 test/blackbox-tests/test-cases/cmdliner-dep-conf.t/run.t diff --git a/test/blackbox-tests/test-cases/cmdline/profile.t b/test/blackbox-tests/test-cases/cmdline/profile.t index 1525053821c7..f3cc746b614c 100644 --- a/test/blackbox-tests/test-cases/cmdline/profile.t +++ b/test/blackbox-tests/test-cases/cmdline/profile.t @@ -1,7 +1,7 @@ # Bug #4632 $ dune build -p - dune: option '-p' needs an argument + dune build: option '-p' needs an argument Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/cmdliner-dep-conf.t/run.t b/test/blackbox-tests/test-cases/cmdliner-dep-conf.t/run.t old mode 100755 new mode 100644 index 2213ae13898e..60ea166e0df6 --- a/test/blackbox-tests/test-cases/cmdliner-dep-conf.t/run.t +++ b/test/blackbox-tests/test-cases/cmdliner-dep-conf.t/run.t @@ -14,13 +14,13 @@ [1] $ dune build "(fi" - dune: TARGET… arguments: unclosed parenthesis at end of input + dune build: TARGET… arguments: unclosed parenthesis at end of input Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build "()" - dune: TARGET… arguments: Unexpected list + dune build: TARGET… arguments: Unexpected list Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/describe.t b/test/blackbox-tests/test-cases/describe.t index a27cde0d31d1..95e0365641c1 100644 --- a/test/blackbox-tests/test-cases/describe.t +++ b/test/blackbox-tests/test-cases/describe.t @@ -1267,10 +1267,10 @@ Test errors [1] $ dune describe --lang 1.0 - dune: Only --lang 0.1 is available at the moment as this command is not yet - stabilised. If you would like to release a software that relies on the output - of 'dune describe', please open a ticket on - https://github.com/ocaml/dune. + dune describe: Only --lang 0.1 is available at the moment as this command is not yet + stabilised. If you would like to release a software that relies on the output + of 'dune describe', please open a ticket on + https://github.com/ocaml/dune. Usage: dune describe [OPTION]… [STRING]… Try 'dune describe --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/dune-init.t/run.t b/test/blackbox-tests/test-cases/dune-init.t/run.t index eb82ed5ea6e2..ccd2ce5f830a 100644 --- a/test/blackbox-tests/test-cases/dune-init.t/run.t +++ b/test/blackbox-tests/test-cases/dune-init.t/run.t @@ -251,10 +251,11 @@ Comments in dune files are preserved Will not create components with invalid names $ dune init lib invalid-component-name ./_test_lib - dune: NAME argument: invalid component name `invalid-component-name' - Library names must be non-empty and composed only of the - following - characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'. + dune init: NAME argument: invalid component name + `invalid-component-name' + Library names must be non-empty and composed only of the + following + characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'. Usage: dune init [OPTION]… COMPONENT NAME [PATH] Try 'dune init --help' or 'dune --help' for more information. [1] @@ -264,8 +265,8 @@ Will not create components with invalid names Will fail and inform user when invalid component command is given $ dune init foo blah - dune: COMPONENT argument: invalid value 'foo', expected one of 'executable', - 'library', 'project' or 'test' + dune init: COMPONENT argument: invalid value 'foo', expected one of + 'executable', 'library', 'project' or 'test' Usage: dune init [OPTION]… COMPONENT NAME [PATH] Try 'dune init --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/external-lib-deps.t b/test/blackbox-tests/test-cases/external-lib-deps.t index 4fea65397fe4..1ba689c12eb9 100644 --- a/test/blackbox-tests/test-cases/external-lib-deps.t +++ b/test/blackbox-tests/test-cases/external-lib-deps.t @@ -1,5 +1,5 @@ external-lib-deps is no more. $ dune external-lib-deps - dune: This subcommand is no longer implemented. + dune external-lib-deps: This subcommand is no longer implemented. [1] diff --git a/test/blackbox-tests/test-cases/github3046.t b/test/blackbox-tests/test-cases/github3046.t index 3e69b68328c3..571f0940b779 100644 --- a/test/blackbox-tests/test-cases/github3046.t +++ b/test/blackbox-tests/test-cases/github3046.t @@ -7,8 +7,8 @@ are given as parameters `dune init exe main --libs="str gsl"` returns an informative parsing error $ dune init exe main --libs="str gsl" - dune: option '--libs': invalid element in list ('str gsl'): expected a valid - dune atom + dune init: option '--libs': invalid element in list ('str gsl'): expected a + valid dune atom Usage: dune init [OPTION]… COMPONENT NAME [PATH] Try 'dune init --help' or 'dune --help' for more information. [1] @@ -16,8 +16,8 @@ are given as parameters `dune init lib foo --ppx="foo bar"` returns an informative parsing error $ dune init lib foo --ppx="foo bar" - dune: option '--ppx': invalid element in list ('foo bar'): expected a valid - dune atom + dune init: option '--ppx': invalid element in list ('foo bar'): expected a + valid dune atom Usage: dune init [OPTION]… COMPONENT NAME [PATH] Try 'dune init --help' or 'dune --help' for more information. [1] @@ -25,10 +25,11 @@ are given as parameters `dune init lib foo --public="some/invalid&name!"` returns an informative parsing error $ dune init lib foo --public="some/invalid&name!" - dune: option '--public': invalid component name `some/invalid&name!' - Library names must be non-empty and composed only of the - following - characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'. + dune init: option '--public': invalid component name + `some/invalid&name!' + Library names must be non-empty and composed only of the + following + characters: 'A'..'Z', 'a'..'z', '_' or '0'..'9'. Usage: dune init [OPTION]… COMPONENT NAME [PATH] Try 'dune init --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/github3530.t b/test/blackbox-tests/test-cases/github3530.t index 6583ab892e0e..2d8795fe66f2 100644 --- a/test/blackbox-tests/test-cases/github3530.t +++ b/test/blackbox-tests/test-cases/github3530.t @@ -2,7 +2,7 @@ When an empty string is passed to `-p`, we get a nice error message. $ echo '(lang dune 2.0)' > dune-project $ dune build -p '' - dune: option '--only-packages': Invalid package name: "" + dune build: option '--only-packages': Invalid package name: "" Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] @@ -10,7 +10,7 @@ When an empty string is passed to `-p`, we get a nice error message. This can happen in a list as well: $ dune build -p 'a,b,' - dune: option '--only-packages': Invalid package name: "" + dune build: option '--only-packages': Invalid package name: "" Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] diff --git a/test/blackbox-tests/test-cases/misc.t/run.t b/test/blackbox-tests/test-cases/misc.t/run.t index fdc5fd94b8e8..26e6b5c191fc 100644 --- a/test/blackbox-tests/test-cases/misc.t/run.t +++ b/test/blackbox-tests/test-cases/misc.t/run.t @@ -6,37 +6,37 @@ Test that incompatible options are properly reported ---------------------------------------------------- $ dune build --verbose --display quiet - dune: Cannot use --verbose and --display simultaneously + dune build: Cannot use --verbose and --display simultaneously Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build -p toto --root . - dune: option '--root' cannot be repeated + dune build: option '--root' cannot be repeated Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build --for-release-of-packages toto --root . - dune: option '--root' cannot be repeated + dune build: option '--root' cannot be repeated Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build --no-config --config x - dune: Cannot use --config and --no-config simultaneously + dune build: Cannot use --config and --no-config simultaneously Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build -p toto --release - dune: option '--root' cannot be repeated + dune build: option '--root' cannot be repeated Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] $ dune build --release --root . - dune: option '--root' cannot be repeated + dune build: option '--root' cannot be repeated Usage: dune build [OPTION]… [TARGET]… Try 'dune build --help' or 'dune --help' for more information. [1] diff --git a/vendor/cmdliner/src/cmdliner.mli b/vendor/cmdliner/src/cmdliner.mli index 47ed205ee0e1..c6d179a97736 100644 --- a/vendor/cmdliner/src/cmdliner.mli +++ b/vendor/cmdliner/src/cmdliner.mli @@ -573,8 +573,10 @@ module Cmd : sig (** {1:info Environment variable information} *) [@@@alert "-deprecated"] + type info = Term.env_info (* because of Arg. *) (** The type for environment variable information. *) + [@@@alert "+deprecated"] val info : ?deprecated:string -> ?docs:string -> ?doc:string -> var -> info @@ -799,11 +801,13 @@ module Arg : sig (** The type for converted argument printers. *) [@@@alert "-deprecated"] (* Need to be able to mention them ! *) + type 'a conv = 'a parser * 'a printer (** The type for argument converters. {b Warning.} Do not use directly, use {!val-conv} or {!val-conv'}. This type will become abstract in the next major version of cmdliner. *) + [@@@alert "+deprecated"] (* Need to be able to mention them ! *) val conv : diff --git a/vendor/cmdliner/src/cmdliner_msg.ml b/vendor/cmdliner/src/cmdliner_msg.ml index a61c8159612a..c6389daed56f 100644 --- a/vendor/cmdliner/src/cmdliner_msg.ml +++ b/vendor/cmdliner/src/cmdliner_msg.ml @@ -71,7 +71,10 @@ let err_cmd_missing ~dom = (* Other messages *) -let exec_name ei = Cmdliner_info.Cmd.name @@ Cmdliner_info.Eval.main ei +let exec_name ei = + let cmd = Cmdliner_info.Eval.cmd ei in + let parents = Cmdliner_info.Eval.parents ei in + String.concat " " @@ List.rev_map Cmdliner_info.Cmd.name @@ cmd::parents let pp_version ppf ei = match Cmdliner_info.Cmd.version @@ Cmdliner_info.Eval.main ei with diff --git a/vendor/update-cmdliner.sh b/vendor/update-cmdliner.sh index d5c1359d95a9..454a27132e6e 100755 --- a/vendor/update-cmdliner.sh +++ b/vendor/update-cmdliner.sh @@ -1,6 +1,6 @@ #!/bin/bash -version=37a715a37393516860a58d8ac6d38ac9bc5d7c96 +version=7b1940f6c5fdd85189bed10a12068d1f756e01c3 set -e -o pipefail