From 45f2d389a61bd008705ae5296b210473160390a1 Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 26 Mar 2024 16:36:50 +0100 Subject: [PATCH 01/18] Add new commands --- tests/Argu.Tests/Tests.fs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 8c164c4c..d9ee986b 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -80,6 +80,20 @@ module ``Argu Tests Main List`` = interface IArgParserTemplate with member this.Usage = "gus" + type SeveralMandatoriesSubCommand = + | [] ValueA of int + | [] ValueB of int + | [] ValueC of int + | ValueD of int + with + interface IArgParserTemplate with + member this.Usage = + match this with + | ValueA _ -> "Value a" + | ValueB _ -> "Value b" + | ValueC _ -> "Value c" + | ValueD _ -> "Value d" + type Argument = | [] Verbose | Working_Directory of string @@ -116,6 +130,7 @@ module ``Argu Tests Main List`` = | [] Clean of ParseResults | [] Required of ParseResults | [] Unrecognized of ParseResults + | [] Several_Mandatories of ParseResults | [] Nullary_Sub interface IArgParserTemplate with member a.Usage = @@ -150,6 +165,7 @@ module ``Argu Tests Main List`` = | Clean _ -> "clean state" | Required _ -> "required subcommand" | Unrecognized _ -> "unrecognized subcommand" + | Several_Mandatories _ -> "several mandatories subcommand" | Nullary_Sub -> "nullary subcommand" | List _ -> "variadic params" | Optional _ -> "optional params" @@ -661,7 +677,7 @@ module ``Argu Tests Main List`` = [] let ``Get all subcommand parsers`` () = let subcommands = parser.GetSubCommandParsers() - test <@ subcommands.Length = 6 @> + test <@ subcommands.Length = 7 @> test <@ subcommands |> List.forall (fun sc -> sc.IsSubCommandParser) @> [] From 2cfcc4a1d4a48b8f4aa0260d82b5f7d7f2c8ad41 Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 26 Mar 2024 16:44:03 +0100 Subject: [PATCH 02/18] Display all missing cases --- src/Argu/Parsers/Common.fs | 5 +++-- tests/Argu.Tests/Tests.fs | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Argu/Parsers/Common.fs b/src/Argu/Parsers/Common.fs index dfc44946..d3bff3ca 100644 --- a/src/Argu/Parsers/Common.fs +++ b/src/Argu/Parsers/Common.fs @@ -70,8 +70,9 @@ let postProcessResults (argInfo : UnionArgInfo) (ignoreMissingMandatory : bool) | _, ts' -> ts' match combined, commandLineResults with - | _, Some { MissingMandatoryCases = missingCase::_ } when not ignoreMissingMandatory -> - error argInfo ErrorCode.PostProcess "missing parameter '%s'." missingCase.Name.Value + | _, Some { MissingMandatoryCases = (missingCase::_) as missingCases } when not ignoreMissingMandatory -> + let allCasesFormatted = missingCases |> Seq.map (fun c -> c.Name.Value) |> fun v -> System.String.Join("', '", v) + error argInfo ErrorCode.PostProcess "missing parameter '%s'." allCasesFormatted | [||], _ when caseInfo.IsMandatory.Value && not ignoreMissingMandatory -> error argInfo ErrorCode.PostProcess "missing parameter '%s'." caseInfo.Name.Value diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index d9ee986b..cf84e583 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -490,6 +490,12 @@ module ``Argu Tests Main List`` = raisesWith <@ parser.ParseCommandLine args @> (fun e -> <@ e.FirstLine.Contains "--branch" @>) + [] + let ``Main command parsing should fail and display all missing mandatories sub command parameters`` () = + let args = [|"--mandatory-arg" ; "true" ; "several-mandatories" ; "--valuea"; "5"|] + raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> + (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'." @>) + [] let ``Main command parsing should not fail on missing mandatory sub command parameter if ignoreMissing`` () = let args = [|"--mandatory-arg" ; "true" ; "checkout" |] From 8edbf9d1e9587fff6d496ca76d9fe78aa7ad09c1 Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 26 Mar 2024 16:48:15 +0100 Subject: [PATCH 03/18] Display subcommand help if error --- src/Argu/Parsers/Cli.fs | 4 ++-- src/Argu/Parsers/Common.fs | 4 ++-- src/Argu/UnionArgInfo.fs | 2 +- tests/Argu.Tests/Tests.fs | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/Argu/Parsers/Cli.fs b/src/Argu/Parsers/Cli.fs index 084ad0c8..3d68d938 100644 --- a/src/Argu/Parsers/Cli.fs +++ b/src/Argu/Parsers/Cli.fs @@ -79,7 +79,7 @@ type CliParseResultAggregator internal (argInfo : UnionArgInfo, stack : CliParse let unrecognized = ResizeArray() let unrecognizedParseResults = ResizeArray() let results = lazy(argInfo.Cases.Value |> Array.map (fun _ -> ResizeArray())) - let missingMandatoryCasesOfNestedResults = ResizeArray() + let missingMandatoryCasesOfNestedResults = ResizeArray() member val IsUsageRequested = false with get,set @@ -135,7 +135,7 @@ type CliParseResultAggregator internal (argInfo : UnionArgInfo, stack : CliParse IsUsageRequested = x.IsUsageRequested MissingMandatoryCases = [ yield! missingMandatoryCasesOfNestedResults - yield! argInfo.Cases.Value |> Seq.filter (fun case -> case.IsMandatory.Value && results.Value[case.Tag].Count = 0) + yield argInfo, (argInfo.Cases.Value |> Seq.filter (fun case -> case.IsMandatory.Value && results.Value[case.Tag].Count = 0) |> Seq.toList) ] } diff --git a/src/Argu/Parsers/Common.fs b/src/Argu/Parsers/Common.fs index d3bff3ca..3a526b75 100644 --- a/src/Argu/Parsers/Common.fs +++ b/src/Argu/Parsers/Common.fs @@ -70,9 +70,9 @@ let postProcessResults (argInfo : UnionArgInfo) (ignoreMissingMandatory : bool) | _, ts' -> ts' match combined, commandLineResults with - | _, Some { MissingMandatoryCases = (missingCase::_) as missingCases } when not ignoreMissingMandatory -> + | _, Some { MissingMandatoryCases = (caseArgInfo, (_::_ as missingCases))::_ } when not ignoreMissingMandatory -> let allCasesFormatted = missingCases |> Seq.map (fun c -> c.Name.Value) |> fun v -> System.String.Join("', '", v) - error argInfo ErrorCode.PostProcess "missing parameter '%s'." allCasesFormatted + error caseArgInfo ErrorCode.PostProcess "missing parameter '%s'." allCasesFormatted | [||], _ when caseInfo.IsMandatory.Value && not ignoreMissingMandatory -> error argInfo ErrorCode.PostProcess "missing parameter '%s'." caseInfo.Name.Value diff --git a/src/Argu/UnionArgInfo.fs b/src/Argu/UnionArgInfo.fs index 631c383c..e8bd7771 100644 --- a/src/Argu/UnionArgInfo.fs +++ b/src/Argu/UnionArgInfo.fs @@ -204,7 +204,7 @@ type UnionParseResults = UnrecognizedCliParseResults : obj list /// Usage string requested by the caller IsUsageRequested : bool - MissingMandatoryCases: UnionCaseArgInfo list + MissingMandatoryCases: (UnionArgInfo * (UnionCaseArgInfo list)) list } type UnionCaseArgInfo with diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index cf84e583..a2442462 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -874,6 +874,11 @@ module ``Argu Tests Main List`` = let results = parser.ParseCommandLine (args, raiseOnUsage = false) test <@ results.IsUsageRequested @> + [] + let ``Required subcommand attribute should fail on missing subcommand2`` () = + let args = [|"--mandatory-arg" ; "true" ; "several-mandatories" ; "--valuea"; "5"|] + raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> + (fun e -> <@ e.Message.Contains "valuec" && e.Message.Contains "valuea" @>) [] [] From faeb33b5b1ab36b24f45050a5c4e831bc4e2614b Mon Sep 17 00:00:00 2001 From: fpellet Date: Tue, 26 Mar 2024 16:50:31 +0100 Subject: [PATCH 04/18] refactor --- src/Argu/Parsers/Cli.fs | 6 +++++- src/Argu/Parsers/Common.fs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Argu/Parsers/Cli.fs b/src/Argu/Parsers/Cli.fs index 3d68d938..9e0b0ab2 100644 --- a/src/Argu/Parsers/Cli.fs +++ b/src/Argu/Parsers/Cli.fs @@ -135,7 +135,11 @@ type CliParseResultAggregator internal (argInfo : UnionArgInfo, stack : CliParse IsUsageRequested = x.IsUsageRequested MissingMandatoryCases = [ yield! missingMandatoryCasesOfNestedResults - yield argInfo, (argInfo.Cases.Value |> Seq.filter (fun case -> case.IsMandatory.Value && results.Value[case.Tag].Count = 0) |> Seq.toList) + + match argInfo.Cases.Value |> Seq.filter (fun case -> case.IsMandatory.Value && results.Value[case.Tag].Count = 0) |> Seq.toList with + | [] -> () + | missingCases -> + yield argInfo, missingCases ] } diff --git a/src/Argu/Parsers/Common.fs b/src/Argu/Parsers/Common.fs index 3a526b75..888119a3 100644 --- a/src/Argu/Parsers/Common.fs +++ b/src/Argu/Parsers/Common.fs @@ -70,7 +70,7 @@ let postProcessResults (argInfo : UnionArgInfo) (ignoreMissingMandatory : bool) | _, ts' -> ts' match combined, commandLineResults with - | _, Some { MissingMandatoryCases = (caseArgInfo, (_::_ as missingCases))::_ } when not ignoreMissingMandatory -> + | _, Some { MissingMandatoryCases = (caseArgInfo, missingCases)::_ } when not ignoreMissingMandatory -> let allCasesFormatted = missingCases |> Seq.map (fun c -> c.Name.Value) |> fun v -> System.String.Join("', '", v) error caseArgInfo ErrorCode.PostProcess "missing parameter '%s'." allCasesFormatted From 5a690475e43d84b4771ec59c251267132b70dfd1 Mon Sep 17 00:00:00 2001 From: Florent Pellet Date: Wed, 27 Mar 2024 10:23:29 +0100 Subject: [PATCH 05/18] style: Update src/Argu/UnionArgInfo.fs Co-authored-by: Ruben Bartelink --- src/Argu/UnionArgInfo.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Argu/UnionArgInfo.fs b/src/Argu/UnionArgInfo.fs index e8bd7771..b1d6b131 100644 --- a/src/Argu/UnionArgInfo.fs +++ b/src/Argu/UnionArgInfo.fs @@ -204,7 +204,7 @@ type UnionParseResults = UnrecognizedCliParseResults : obj list /// Usage string requested by the caller IsUsageRequested : bool - MissingMandatoryCases: (UnionArgInfo * (UnionCaseArgInfo list)) list + MissingMandatoryCases: (UnionArgInfo * UnionCaseArgInfo list) list } type UnionCaseArgInfo with From d5ef244d4193a0072b3ec142c3be93df414f2f75 Mon Sep 17 00:00:00 2001 From: Florent Pellet Date: Wed, 27 Mar 2024 10:23:47 +0100 Subject: [PATCH 06/18] reword: Update tests/Argu.Tests/Tests.fs Co-authored-by: Ruben Bartelink --- tests/Argu.Tests/Tests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index a2442462..f4191039 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -80,7 +80,7 @@ module ``Argu Tests Main List`` = interface IArgParserTemplate with member this.Usage = "gus" - type SeveralMandatoriesSubCommand = + type MultipleMandatoriesSubCommand = | [] ValueA of int | [] ValueB of int | [] ValueC of int From c4f9c12f0879744d0a655236fae531cde86cb7be Mon Sep 17 00:00:00 2001 From: Florent Pellet Date: Wed, 27 Mar 2024 10:25:20 +0100 Subject: [PATCH 07/18] style: Update src/Argu/Parsers/Cli.fs Co-authored-by: Ruben Bartelink --- src/Argu/Parsers/Cli.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Argu/Parsers/Cli.fs b/src/Argu/Parsers/Cli.fs index 9e0b0ab2..4403363f 100644 --- a/src/Argu/Parsers/Cli.fs +++ b/src/Argu/Parsers/Cli.fs @@ -79,7 +79,7 @@ type CliParseResultAggregator internal (argInfo : UnionArgInfo, stack : CliParse let unrecognized = ResizeArray() let unrecognizedParseResults = ResizeArray() let results = lazy(argInfo.Cases.Value |> Array.map (fun _ -> ResizeArray())) - let missingMandatoryCasesOfNestedResults = ResizeArray() + let missingMandatoryCasesOfNestedResults = ResizeArray() member val IsUsageRequested = false with get,set From 4f4a180197b396e51afd30c687c79b5ce7debdc1 Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 10:28:21 +0100 Subject: [PATCH 08/18] fixup! reword: Update tests/Argu.Tests/Tests.fs --- tests/Argu.Tests/Tests.fs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index f4191039..4a682d67 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -130,7 +130,7 @@ module ``Argu Tests Main List`` = | [] Clean of ParseResults | [] Required of ParseResults | [] Unrecognized of ParseResults - | [] Several_Mandatories of ParseResults + | [] Multiple_Mandatories of ParseResults | [] Nullary_Sub interface IArgParserTemplate with member a.Usage = @@ -165,7 +165,7 @@ module ``Argu Tests Main List`` = | Clean _ -> "clean state" | Required _ -> "required subcommand" | Unrecognized _ -> "unrecognized subcommand" - | Several_Mandatories _ -> "several mandatories subcommand" + | Multiple_Mandatories _ -> "multiple mandatories subcommand" | Nullary_Sub -> "nullary subcommand" | List _ -> "variadic params" | Optional _ -> "optional params" @@ -492,7 +492,7 @@ module ``Argu Tests Main List`` = [] let ``Main command parsing should fail and display all missing mandatories sub command parameters`` () = - let args = [|"--mandatory-arg" ; "true" ; "several-mandatories" ; "--valuea"; "5"|] + let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'." @>) @@ -876,7 +876,7 @@ module ``Argu Tests Main List`` = [] let ``Required subcommand attribute should fail on missing subcommand2`` () = - let args = [|"--mandatory-arg" ; "true" ; "several-mandatories" ; "--valuea"; "5"|] + let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> (fun e -> <@ e.Message.Contains "valuec" && e.Message.Contains "valuea" @>) From 847586497ccfe9cfc9a6e34832067af59bbaf9be Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 10:33:43 +0100 Subject: [PATCH 09/18] Improve test --- tests/Argu.Tests/Tests.fs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 4a682d67..3ef41e1a 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -875,10 +875,10 @@ module ``Argu Tests Main List`` = test <@ results.IsUsageRequested @> [] - let ``Required subcommand attribute should fail on missing subcommand2`` () = + let ``Required subcommand attribute should fail on missing subcommand and display usage of subcommand and not main command`` () = let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] - raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> - (fun e -> <@ e.Message.Contains "valuec" && e.Message.Contains "valuea" @>) + raisesWith <@ parser.ParseCommandLine(args) @> + (fun e -> <@ e.Message.Contains $"USAGE: {parser.ProgramName} multiple-mandatories [--help] --valuea " @>) [] [] From 27034173c711390b69ced2690214f23501f6436c Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 10:36:11 +0100 Subject: [PATCH 10/18] style --- tests/Argu.Tests/Tests.fs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 3ef41e1a..c3416877 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -85,14 +85,7 @@ module ``Argu Tests Main List`` = | [] ValueB of int | [] ValueC of int | ValueD of int - with - interface IArgParserTemplate with - member this.Usage = - match this with - | ValueA _ -> "Value a" - | ValueB _ -> "Value b" - | ValueC _ -> "Value c" - | ValueD _ -> "Value d" + interface IArgParserTemplate with member this.Usage = "multiple mandatories subcommand arg" type Argument = | [] Verbose From 799dd9223b84dec9b424b365d9a8d07bb3cb42ed Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 10:44:25 +0100 Subject: [PATCH 11/18] Update release note --- RELEASE_NOTES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bebfe5a3..cf224a21 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,7 @@ +### 6.3.0 +* Improve error message on missing cases on a subcommands (display all missing cases) [#236](https://github.com/fsprojects/Argu/pull/236) +* Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix usage display when there are missing case in subcommands. [#236](https://github.com/fsprojects/Argu/pull/236) + ### 6.2.2 * Fix default `programName` when invoking via a wrapper such as `dotnet.exe` [#233](https://github.com/fsprojects/Argu/pull/233) From 90038918e56f26eecb3c21a791e99e54510f03dd Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 11:11:02 +0100 Subject: [PATCH 12/18] test: check first line --- tests/Argu.Tests/Tests.fs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index c3416877..88fc1a7f 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -871,7 +871,8 @@ module ``Argu Tests Main List`` = let ``Required subcommand attribute should fail on missing subcommand and display usage of subcommand and not main command`` () = let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] raisesWith <@ parser.ParseCommandLine(args) @> - (fun e -> <@ e.Message.Contains $"USAGE: {parser.ProgramName} multiple-mandatories [--help] --valuea " @>) + (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'" + && e.Message.Contains $"USAGE: {parser.ProgramName} multiple-mandatories [--help] --valuea " @>) [] [] From ccf18eb4ffc90b9c67c7fcf82a601f884ca27c53 Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 11:11:27 +0100 Subject: [PATCH 13/18] style --- tests/Argu.Tests/Tests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 88fc1a7f..3574bc3a 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -870,7 +870,7 @@ module ``Argu Tests Main List`` = [] let ``Required subcommand attribute should fail on missing subcommand and display usage of subcommand and not main command`` () = let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] - raisesWith <@ parser.ParseCommandLine(args) @> + raisesWith <@ parser.ParseCommandLine args @> (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'" && e.Message.Contains $"USAGE: {parser.ProgramName} multiple-mandatories [--help] --valuea " @>) From 2d937137959adf6d055f199d2d9e202788a078f7 Mon Sep 17 00:00:00 2001 From: Florent Pellet Date: Wed, 27 Mar 2024 17:18:35 +0100 Subject: [PATCH 14/18] Update RELEASE_NOTES.md Co-authored-by: Ruben Bartelink --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index cf224a21..9605e0b3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ### 6.3.0 * Improve error message on missing cases on a subcommands (display all missing cases) [#236](https://github.com/fsprojects/Argu/pull/236) -* Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix usage display when there are missing case in subcommands. [#236](https://github.com/fsprojects/Argu/pull/236) +* Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix usage display when there are missing case in subcommands. [#236](https://github.com/fsprojects/Argu/pull/236) [@fpellet](https://github.com/fpellet) ### 6.2.2 * Fix default `programName` when invoking via a wrapper such as `dotnet.exe` [#233](https://github.com/fsprojects/Argu/pull/233) From 16a480e6e0b785773282d03f8ac1a560c3feab15 Mon Sep 17 00:00:00 2001 From: Florent Pellet Date: Wed, 27 Mar 2024 17:19:17 +0100 Subject: [PATCH 15/18] Update RELEASE_NOTES.md Co-authored-by: Ruben Bartelink --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9605e0b3..9f955445 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,5 +1,5 @@ ### 6.3.0 -* Improve error message on missing cases on a subcommands (display all missing cases) [#236](https://github.com/fsprojects/Argu/pull/236) +* Improve error message on missing cases on a subcommands (display all missing cases) [#236](https://github.com/fsprojects/Argu/pull/236) [@fpellet](https://github.com/fpellet) * Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix usage display when there are missing case in subcommands. [#236](https://github.com/fsprojects/Argu/pull/236) [@fpellet](https://github.com/fpellet) ### 6.2.2 From 7b06d74c165af974cda069e262a7af7471df0499 Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 17:21:25 +0100 Subject: [PATCH 16/18] Fix version --- RELEASE_NOTES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 9f955445..1f034c9b 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,4 +1,4 @@ -### 6.3.0 +### 6.2.3 * Improve error message on missing cases on a subcommands (display all missing cases) [#236](https://github.com/fsprojects/Argu/pull/236) [@fpellet](https://github.com/fpellet) * Fix the regression of the [#127](https://github.com/fsprojects/Argu/pull/127) merged in 6.1.2 and fix usage display when there are missing case in subcommands. [#236](https://github.com/fsprojects/Argu/pull/236) [@fpellet](https://github.com/fpellet) From 922061d0bed7219f2b535360b037e00dd57f48e7 Mon Sep 17 00:00:00 2001 From: fpellet Date: Wed, 27 Mar 2024 17:27:04 +0100 Subject: [PATCH 17/18] Reword test --- tests/Argu.Tests/Tests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 3574bc3a..136bcfd6 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -868,7 +868,7 @@ module ``Argu Tests Main List`` = test <@ results.IsUsageRequested @> [] - let ``Required subcommand attribute should fail on missing subcommand and display usage of subcommand and not main command`` () = + let ``Should fail if mandatory case is missing on a subcommand and display usage of subcommand and not main command`` () = let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] raisesWith <@ parser.ParseCommandLine args @> (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'" From d244bfc502ae4b851d9a59426f0c80950a60a836 Mon Sep 17 00:00:00 2001 From: fpellet Date: Thu, 28 Mar 2024 11:18:05 +0100 Subject: [PATCH 18/18] style: missing change --- tests/Argu.Tests/Tests.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Argu.Tests/Tests.fs b/tests/Argu.Tests/Tests.fs index 136bcfd6..9d1a5101 100644 --- a/tests/Argu.Tests/Tests.fs +++ b/tests/Argu.Tests/Tests.fs @@ -486,7 +486,7 @@ module ``Argu Tests Main List`` = [] let ``Main command parsing should fail and display all missing mandatories sub command parameters`` () = let args = [|"--mandatory-arg" ; "true" ; "multiple-mandatories" ; "--valuea"; "5"|] - raisesWith <@ parser.ParseCommandLine(args, raiseOnUsage = true) @> + raisesWith <@ parser.ParseCommandLine args @> (fun e -> <@ e.FirstLine.Contains "ERROR: missing parameter '--valueb', '--valuec'." @>) []