From 6ccc9fa00877b03e3202775178dcdd956ef031f9 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Fri, 17 Apr 2026 11:33:04 -0700 Subject: [PATCH] chore: remove dead CommandLineParser dependency Spectre.Console.Cli is the active CLI parser. The CommandLineParser package and IArgumentHelper/ArgumentHelper types had no remaining callers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Directory.Packages.props | 1 - .../ArgumentHelper.cs | 50 ------------------- .../Extensions/ServiceCollectionExtensions.cs | 1 - .../IArgumentHelper.cs | 10 ---- ...oft.ComponentDetection.Orchestrator.csproj | 1 - 5 files changed, 63 deletions(-) delete mode 100644 src/Microsoft.ComponentDetection.Orchestrator/ArgumentHelper.cs delete mode 100644 src/Microsoft.ComponentDetection.Orchestrator/IArgumentHelper.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index e76d6d782..359e51a00 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,7 +6,6 @@ - diff --git a/src/Microsoft.ComponentDetection.Orchestrator/ArgumentHelper.cs b/src/Microsoft.ComponentDetection.Orchestrator/ArgumentHelper.cs deleted file mode 100644 index 820983517..000000000 --- a/src/Microsoft.ComponentDetection.Orchestrator/ArgumentHelper.cs +++ /dev/null @@ -1,50 +0,0 @@ -namespace Microsoft.ComponentDetection.Orchestrator; - -using System.Collections.Generic; -using System.Linq; -using CommandLine; -using Microsoft.ComponentDetection.Orchestrator.Commands; - -internal class ArgumentHelper : IArgumentHelper -{ - private readonly IEnumerable argumentSets; - - public ArgumentHelper(IEnumerable argumentSets) => this.argumentSets = argumentSets; - - public static IDictionary GetDetectorArgs(IEnumerable detectorArgsList) - { - var detectorArgs = new Dictionary(); - - foreach (var arg in detectorArgsList) - { - var keyValue = arg.Split('='); - - if (keyValue.Length != 2) - { - continue; - } - - detectorArgs.Add(keyValue[0], keyValue[1]); - } - - return detectorArgs; - } - - public ParserResult ParseArguments(string[] args) - { - return Parser.Default.ParseArguments(args, this.argumentSets.Select(x => x.GetType()).ToArray()); - } - - public ParserResult ParseArguments(string[] args, bool ignoreInvalidArgs = false) - { - var p = new Parser(x => - { - x.IgnoreUnknownArguments = ignoreInvalidArgs; - - // This is not the main argument dispatch, so we don't want console output. - x.HelpWriter = null; - }); - - return p.ParseArguments(args); - } -} diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs b/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs index 0e0e30360..f0e3233cf 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs +++ b/src/Microsoft.ComponentDetection.Orchestrator/Extensions/ServiceCollectionExtensions.cs @@ -65,7 +65,6 @@ public static IServiceCollection AddComponentDetection(this IServiceCollection s services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); // Experiments services.AddSingleton(); diff --git a/src/Microsoft.ComponentDetection.Orchestrator/IArgumentHelper.cs b/src/Microsoft.ComponentDetection.Orchestrator/IArgumentHelper.cs deleted file mode 100644 index 6f598269a..000000000 --- a/src/Microsoft.ComponentDetection.Orchestrator/IArgumentHelper.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Microsoft.ComponentDetection.Orchestrator; - -using CommandLine; - -internal interface IArgumentHelper -{ - ParserResult ParseArguments(string[] args); - - ParserResult ParseArguments(string[] args, bool ignoreInvalidArgs = false); -} diff --git a/src/Microsoft.ComponentDetection.Orchestrator/Microsoft.ComponentDetection.Orchestrator.csproj b/src/Microsoft.ComponentDetection.Orchestrator/Microsoft.ComponentDetection.Orchestrator.csproj index de8d469fd..df8c8eb99 100644 --- a/src/Microsoft.ComponentDetection.Orchestrator/Microsoft.ComponentDetection.Orchestrator.csproj +++ b/src/Microsoft.ComponentDetection.Orchestrator/Microsoft.ComponentDetection.Orchestrator.csproj @@ -8,7 +8,6 @@ -