diff --git a/alire.toml b/alire.toml index 32bda836b..e0d1f9134 100644 --- a/alire.toml +++ b/alire.toml @@ -49,7 +49,7 @@ windows = { ALIRE_OS = "windows" } [[pins]] aaa = { url = "https://github.com/mosteo/aaa", commit = "ecc38772bd4a6b469b54c62363766ea1c0e9f912" } ada_toml = { url = "https://github.com/mosteo/ada-toml", commit = "da4e59c382ceb0de6733d571ecbab7ea4919b33d" } -clic = { url = "https://github.com/alire-project/clic", commit = "b40b170b1561adfa99910c69e3897cc2ca441730" } +clic = { url = "https://github.com/alire-project/clic", commit = "de0330053584bad4dbb3dbd5e1ba939c4e8c6b55" } dirty_booleans = { url = "https://github.com/mosteo/dirty_booleans", branch = "main" } diskflags = { url = "https://github.com/mosteo/diskflags", branch = "main" } gnatcoll = { url = "https://github.com/alire-project/gnatcoll-core.git", commit = "4e663b87a028252e7e074f054f8f453661397166" } diff --git a/deps/clic b/deps/clic index b40b170b1..de0330053 160000 --- a/deps/clic +++ b/deps/clic @@ -1 +1 @@ -Subproject commit b40b170b1561adfa99910c69e3897cc2ca441730 +Subproject commit de0330053584bad4dbb3dbd5e1ba939c4e8c6b55 diff --git a/src/alire/alire-os_lib-subprocess.adb b/src/alire/alire-os_lib-subprocess.adb index efc4b94b5..29cd39c2c 100644 --- a/src/alire/alire-os_lib-subprocess.adb +++ b/src/alire/alire-os_lib-subprocess.adb @@ -143,7 +143,7 @@ package body Alire.OS_Lib.Subprocess is Raise_Checked_Error ("Command " & Image (Command, Arguments) - & " exited with code" & Exit_Code'Img + & " exited with code" & AAA.Strings.Trim (Exit_Code'Image) & " and output: " & Output.Flatten (Separator => "\n")); return Output; diff --git a/src/alr/alr-commands.adb b/src/alr/alr-commands.adb index b14916eb3..ca76a58d2 100644 --- a/src/alr/alr-commands.adb +++ b/src/alr/alr-commands.adb @@ -70,9 +70,6 @@ package body Alr.Commands is Debug_Channel : Boolean renames Alire_Early_Elaboration.Switch_D; -- For the stderr debug channel - Help_Switch : aliased Boolean := False; - -- Catches the -h/--help help switch - Prefer_Oldest : aliased Boolean := False; -- Catches the --prefer-oldest policy switch @@ -155,11 +152,6 @@ package body Alr.Commands is "-f", "--force", "Keep going after a recoverable troublesome situation"); - Define_Switch (Config, - Help_Switch'Access, - "-h", "--help", - "Display general or command-specific help"); - Define_Switch (Config, CLIC.User_Input.Not_Interactive'Access, "-n", "--non-interactive", diff --git a/testsuite/tests/help/help-after-double-dash/test.py b/testsuite/tests/help/help-after-double-dash/test.py new file mode 100644 index 000000000..549c62b17 --- /dev/null +++ b/testsuite/tests/help/help-after-double-dash/test.py @@ -0,0 +1,31 @@ +""" +Bug #1379: -h/--help must not trigger our help system after a "--" argument +""" + +import re + +from drivers.alr import init_local_crate, run_alr +from drivers.asserts import assert_match + +# For no command, "--" with help afterwards should simply trigger an error + +assert_match(".*" + re.escape("Unrecognized option '--' (global)"), + run_alr("--", "--help", complain_on_error=False).out) + +# For a command that doesn't understand "--", same: + +assert_match(".*" + re.escape("Unrecognized option '--' (command/topic \"show\")"), + run_alr("show", "--", "--help", complain_on_error=False).out) + +# For `alr exec`, it should trigger the secondary command help and not ours. We +# verify the command being launched includes the "--help" option. Since `exec` +# requires a workspace, we enter one first. + +init_local_crate() + +assert_match(".*" + re.escape('Command ["alr_fake", "--help"] exited with code'), + run_alr("exec", "--", "alr_fake", "--help", + complain_on_error=False).out) +# We don't match the code as it varies between OSes + +print("SUCCESS") diff --git a/testsuite/tests/help/help-after-double-dash/test.yaml b/testsuite/tests/help/help-after-double-dash/test.yaml new file mode 100644 index 000000000..00fb56e10 --- /dev/null +++ b/testsuite/tests/help/help-after-double-dash/test.yaml @@ -0,0 +1,3 @@ +driver: python-script +build_mode: both +indexes: {} \ No newline at end of file