This is an automated email from the ASF dual-hosted git repository.

curth pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-dotnet.git


The following commit(s) were added to refs/heads/main by this push:
     new 16524ff  Move to latest version of System.CommandLine package (#83)
16524ff is described below

commit 16524ff545371972a9324ca72329be3ef4769ee9
Author: Curt Hagenlocher <[email protected]>
AuthorDate: Sat Sep 27 08:28:50 2025 -0700

    Move to latest version of System.CommandLine package (#83)
    
    ## What's Changed
    
    Moves integration tests to the latest version of the System.CommandLine
    package. Also cleans up some small preexisting formatting issues which
    the linter caught this time even though they were present before.
    
    Closes #3.
---
 src/Apache.Arrow/Arrays/LargeStringArray.cs        |  2 +-
 src/Apache.Arrow/Arrays/StringArray.cs             |  2 +-
 src/Apache.Arrow/Arrays/StringViewArray.cs         |  2 +-
 src/Apache.Arrow/Arrays/TimestampArray.cs          |  2 +-
 src/Apache.Arrow/C/CArrowSchemaExporter.cs         |  2 +-
 .../Ipc/ArrowStreamReaderImplementation.cs         |  2 +-
 .../Apache.Arrow.Flight.IntegrationTest.csproj     |  2 +-
 .../Apache.Arrow.Flight.IntegrationTest/Program.cs | 64 ++++++++++++++--------
 .../Apache.Arrow.IntegrationTest.csproj            |  2 +-
 test/Apache.Arrow.IntegrationTest/Program.cs       | 49 ++++++++++-------
 10 files changed, 78 insertions(+), 51 deletions(-)

diff --git a/src/Apache.Arrow/Arrays/LargeStringArray.cs 
b/src/Apache.Arrow/Arrays/LargeStringArray.cs
index e97683f..a12bae6 100644
--- a/src/Apache.Arrow/Arrays/LargeStringArray.cs
+++ b/src/Apache.Arrow/Arrays/LargeStringArray.cs
@@ -81,7 +81,7 @@ public class LargeStringArray : LargeBinaryArray, 
IReadOnlyList<string>, ICollec
         for (int index = 0; index < Length; index++)
         {
             yield return GetString(index);
-        };
+        }
     }
 
     IEnumerator IEnumerable.GetEnumerator() => 
((IEnumerable<string>)this).GetEnumerator();
diff --git a/src/Apache.Arrow/Arrays/StringArray.cs 
b/src/Apache.Arrow/Arrays/StringArray.cs
index 6df1011..918f828 100644
--- a/src/Apache.Arrow/Arrays/StringArray.cs
+++ b/src/Apache.Arrow/Arrays/StringArray.cs
@@ -160,7 +160,7 @@ namespace Apache.Arrow
             for (int index = 0; index < Length; index++)
             {
                 yield return GetString(index);
-            };
+            }
         }
 
         IEnumerator IEnumerable.GetEnumerator() => 
((IEnumerable<string>)this).GetEnumerator();
diff --git a/src/Apache.Arrow/Arrays/StringViewArray.cs 
b/src/Apache.Arrow/Arrays/StringViewArray.cs
index 96eeb19..5411d6b 100644
--- a/src/Apache.Arrow/Arrays/StringViewArray.cs
+++ b/src/Apache.Arrow/Arrays/StringViewArray.cs
@@ -102,7 +102,7 @@ namespace Apache.Arrow
             for (int index = 0; index < Length; index++)
             {
                 yield return GetString(index);
-            };
+            }
         }
 
         IEnumerator IEnumerable.GetEnumerator() => 
((IEnumerable<string>)this).GetEnumerator();
diff --git a/src/Apache.Arrow/Arrays/TimestampArray.cs 
b/src/Apache.Arrow/Arrays/TimestampArray.cs
index ffc6471..28aa1d1 100644
--- a/src/Apache.Arrow/Arrays/TimestampArray.cs
+++ b/src/Apache.Arrow/Arrays/TimestampArray.cs
@@ -156,7 +156,7 @@ namespace Apache.Arrow
             for (int index = 0; index < Length; index++)
             {
                 yield return GetTimestamp(index);
-            };
+            }
         }
 
         int ICollection<DateTimeOffset?>.Count => Length;
diff --git a/src/Apache.Arrow/C/CArrowSchemaExporter.cs 
b/src/Apache.Arrow/C/CArrowSchemaExporter.cs
index 1cf6dc7..4258174 100644
--- a/src/Apache.Arrow/C/CArrowSchemaExporter.cs
+++ b/src/Apache.Arrow/C/CArrowSchemaExporter.cs
@@ -253,7 +253,7 @@ namespace Apache.Arrow.C
                 if (numFields == 0)
                 {
                     throw new NotSupportedException("Exporting nested data 
types with zero children.");
-                };
+                }
 
                 var pointerList = 
(CArrowSchema**)Marshal.AllocHGlobal(numFields * IntPtr.Size);
 
diff --git a/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs 
b/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs
index c1daae9..0b9de1d 100644
--- a/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs
+++ b/src/Apache.Arrow/Ipc/ArrowStreamReaderImplementation.cs
@@ -240,7 +240,7 @@ namespace Apache.Arrow.Ipc
 
                     messageLength = BitUtility.ReadInt32(lengthBuffer);
                 }
-            };
+            }
 
             return messageLength;
         }
diff --git 
a/test/Apache.Arrow.Flight.IntegrationTest/Apache.Arrow.Flight.IntegrationTest.csproj
 
b/test/Apache.Arrow.Flight.IntegrationTest/Apache.Arrow.Flight.IntegrationTest.csproj
index 3403062..93d5b62 100644
--- 
a/test/Apache.Arrow.Flight.IntegrationTest/Apache.Arrow.Flight.IntegrationTest.csproj
+++ 
b/test/Apache.Arrow.Flight.IntegrationTest/Apache.Arrow.Flight.IntegrationTest.csproj
@@ -8,7 +8,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.CommandLine" 
Version="2.0.0-beta4.22272.1" />
+    <PackageReference Include="System.CommandLine" 
Version="2.0.0-rc.1.25451.107" />
     <PackageReference Include="System.Text.Json" Version="8.0.5" />
     <ProjectReference 
Include="..\..\src\Apache.Arrow.Flight\Apache.Arrow.Flight.csproj" />
     <ProjectReference 
Include="..\Apache.Arrow.Flight.TestWeb\Apache.Arrow.Flight.TestWeb.csproj" />
diff --git a/test/Apache.Arrow.Flight.IntegrationTest/Program.cs 
b/test/Apache.Arrow.Flight.IntegrationTest/Program.cs
index 24d39de..97a0d1c 100644
--- a/test/Apache.Arrow.Flight.IntegrationTest/Program.cs
+++ b/test/Apache.Arrow.Flight.IntegrationTest/Program.cs
@@ -13,7 +13,9 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+using System;
 using System.CommandLine;
+using System.CommandLine.Parsing;
 using System.IO;
 using System.Threading.Tasks;
 
@@ -23,18 +25,18 @@ public static class Program
 {
     public static async Task<int> Main(string[] args)
     {
-        var portOption = new Option<int>(
-            new[] { "--port", "-p" },
-            description: "Port the Flight server is listening on");
-        var scenarioOption = new Option<string>(
-            new[] { "--scenario", "-s" },
-            "The name of the scenario to run");
-        var pathOption = new Option<FileInfo>(
-            new[] { "--path", "-j" },
-            "Path to a JSON file of test data");
-
-        var rootCommand = new RootCommand(
-            "Integration test application for Apache.Arrow .NET Flight.");
+        var portOption = new Option<int>("--port", "-p")
+        {
+            Description = "Port the Flight server is listening on",
+        };
+        var scenarioOption = new Option<string>("--scenario", "-s")
+        {
+            Description = "The name of the scenario to run",
+        };
+        var pathOption = new Option<FileInfo>("--path", "-j")
+        {
+            Description = "Path to a JSON file of test data",
+        };
 
         var clientCommand = new Command("client", "Run the Flight client")
         {
@@ -42,26 +44,42 @@ public static class Program
             scenarioOption,
             pathOption,
         };
-        rootCommand.AddCommand(clientCommand);
-
-        clientCommand.SetHandler(async (port, scenario, jsonFile) =>
+        clientCommand.SetAction(async (parseResult, cancellationToken) =>
         {
-            var command = new FlightClientCommand(port, scenario, jsonFile);
+            var command = new FlightClientCommand(
+                parseResult.GetValue(portOption),
+                parseResult.GetValue(scenarioOption),
+                parseResult.GetValue(pathOption));
             await command.Execute().ConfigureAwait(false);
-        }, portOption, scenarioOption, pathOption);
+        });
 
         var serverCommand = new Command("server", "Run the Flight server")
         {
             scenarioOption,
         };
-        rootCommand.AddCommand(serverCommand);
-
-        serverCommand.SetHandler(async scenario =>
+        serverCommand.SetAction(async (parseResult, cancellationToken) =>
         {
-            var command = new FlightServerCommand(scenario);
+            var command = new FlightServerCommand(
+                parseResult.GetValue(scenarioOption));
             await command.Execute().ConfigureAwait(false);
-        }, scenarioOption);
+        });
+
+        var rootCommand = new RootCommand("Integration test application for 
Apache.Arrow .NET Flight.")
+        {
+            clientCommand,
+            serverCommand,
+        };
 
-        return await rootCommand.InvokeAsync(args).ConfigureAwait(false);
+        ParseResult parseResult = rootCommand.Parse(args);
+        if (parseResult.Errors.Count == 0)
+        {
+            return await parseResult.InvokeAsync();
+        }
+
+        foreach (ParseError parseError in parseResult.Errors)
+        {
+            Console.Error.WriteLine(parseError.Message);
+        }
+        return 1;
     }
 }
diff --git 
a/test/Apache.Arrow.IntegrationTest/Apache.Arrow.IntegrationTest.csproj 
b/test/Apache.Arrow.IntegrationTest/Apache.Arrow.IntegrationTest.csproj
index 2445151..b883ad5 100644
--- a/test/Apache.Arrow.IntegrationTest/Apache.Arrow.IntegrationTest.csproj
+++ b/test/Apache.Arrow.IntegrationTest/Apache.Arrow.IntegrationTest.csproj
@@ -8,7 +8,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="System.CommandLine" 
Version="2.0.0-beta1.21216.1" />
+    <PackageReference Include="System.CommandLine" 
Version="2.0.0-rc.1.25451.107" />
     <PackageReference Include="System.Text.Json" Version="8.0.5" />
     <ProjectReference 
Include="..\..\src\Apache.Arrow.Compression\Apache.Arrow.Compression.csproj" />
     <ProjectReference Include="..\..\src\Apache.Arrow\Apache.Arrow.csproj" />
diff --git a/test/Apache.Arrow.IntegrationTest/Program.cs 
b/test/Apache.Arrow.IntegrationTest/Program.cs
index 8dedd60..bf993b2 100644
--- a/test/Apache.Arrow.IntegrationTest/Program.cs
+++ b/test/Apache.Arrow.IntegrationTest/Program.cs
@@ -14,13 +14,10 @@
 // limitations under the License.
 
 using System;
-using System.Collections.Generic;
 using System.CommandLine;
-using System.CommandLine.Invocation;
+using System.CommandLine.Parsing;
 using System.IO;
-using System.Linq;
 using System.Threading.Tasks;
-using Apache.Arrow.Types;
 
 namespace Apache.Arrow.IntegrationTest
 {
@@ -28,27 +25,39 @@ namespace Apache.Arrow.IntegrationTest
     {
         public static async Task<int> Main(string[] args)
         {
-            var integrationTestCommand = new RootCommand
+            var modeOption = new Option<string>("--mode")
             {
-                new Option<string>(
-                    "--mode",
-                    description: "Which command to run"),
-                new Option<FileInfo>(
-                    new[] { "--json-file", "-j" },
-                    "The JSON file to interact with"),
-                new Option<FileInfo>(
-                    new[] { "--arrow-file", "-a" },
-                    "The arrow file to interact with")
+                Description = "Which command to run",
+            };
+            var jsonFileOption = new Option<FileInfo>("--json-file", "-j")
+            {
+                Description = "The JSON file to interact with",
+            };
+            var arrowFileOption = new Option<FileInfo>("--arrow-file", "-a")
+            {
+                Description = "The arrow file to interact with",
             };
 
-            integrationTestCommand.Description = "Integration test app for 
Apache.Arrow .NET Library.";
+            var integrationTestCommand = new RootCommand("Integration test app 
for Apache.Arrow .NET Library.")
+            {
+                modeOption, jsonFileOption, arrowFileOption
+            };
+
+            ParseResult parseResult = integrationTestCommand.Parse(args);
+            if (parseResult.Errors.Count == 0)
+            {
+                var integrationCommand = new IntegrationCommand(
+                    parseResult.GetValue(modeOption),
+                    parseResult.GetValue(jsonFileOption),
+                    parseResult.GetValue(arrowFileOption));
+                return await integrationCommand.Execute();
+            }
 
-            integrationTestCommand.Handler = CommandHandler.Create<string, 
FileInfo, FileInfo>(async (mode, j, a) =>
+            foreach (ParseError parseError in parseResult.Errors)
             {
-                var integrationCommand = new IntegrationCommand(mode, j, a);
-                await integrationCommand.Execute();
-            });
-            return await integrationTestCommand.InvokeAsync(args);
+                Console.Error.WriteLine(parseError.Message);
+            }
+            return 1;
         }
     }
 }

Reply via email to