From ae5faf78445cdb6504326857853c2799c8191ed7 Mon Sep 17 00:00:00 2001 From: MTsfoni Date: Thu, 19 Jun 2025 16:31:22 +0200 Subject: [PATCH] fix: set AllowMultipleArgumentsPerToken for List based CLI options to true. fixes #433 Signed-off-by: MTsfoni --- src/cyclonedx/Commands/Add/AddFilesCommand.cs | 4 ++-- src/cyclonedx/Commands/MergeCommand.cs | 22 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/cyclonedx/Commands/Add/AddFilesCommand.cs b/src/cyclonedx/Commands/Add/AddFilesCommand.cs index 5dd577e..77f095f 100644 --- a/src/cyclonedx/Commands/Add/AddFilesCommand.cs +++ b/src/cyclonedx/Commands/Add/AddFilesCommand.cs @@ -45,8 +45,8 @@ public static void Configure(System.CommandLine.Command rootCommand) subCommand.Add(new Option("--input-format", "Specify input file format.")); subCommand.Add(new Option("--output-format", "Specify output file format.")); subCommand.Add(new Option("--base-path", "Base path for directory to process (defaults to current working directory if omitted).")); - subCommand.Add(new Option>("--include", "Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).")); - subCommand.Add(new Option>("--exclude", "Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).")); + subCommand.Add(new Option>("--include", "Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).") { AllowMultipleArgumentsPerToken = true}); + subCommand.Add(new Option>("--exclude", "Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).") { AllowMultipleArgumentsPerToken = true }); subCommand.Handler = CommandHandler.Create(AddFiles); rootCommand.Add(subCommand); } diff --git a/src/cyclonedx/Commands/MergeCommand.cs b/src/cyclonedx/Commands/MergeCommand.cs index ba83488..34287ff 100644 --- a/src/cyclonedx/Commands/MergeCommand.cs +++ b/src/cyclonedx/Commands/MergeCommand.cs @@ -31,16 +31,18 @@ public static class MergeCommand public static void Configure(RootCommand rootCommand) { Contract.Requires(rootCommand != null); - var subCommand = new System.CommandLine.Command("merge", "Merge two or more BOMs"); - subCommand.Add(new Option>("--input-files", "Input BOM filenames (separate filenames with a space).")); - subCommand.Add(new Option("--output-file", "Output BOM filename, will write to stdout if no value provided.")); - subCommand.Add(new Option("--input-format", "Specify input file format.")); - subCommand.Add(new Option("--output-format", "Specify output file format.")); - subCommand.Add(new Option("--output-version", "Specify output BOM specification version.")); - subCommand.Add(new Option("--hierarchical", "Perform a hierarchical merge.")); - subCommand.Add(new Option("--group", "Provide the group of software the merged BOM describes.")); - subCommand.Add(new Option("--name", "Provide the name of software the merged BOM describes (required for hierarchical merging).")); - subCommand.Add(new Option("--version", "Provide the version of software the merged BOM describes (required for hierarchical merging).")); + var subCommand = new System.CommandLine.Command("merge", "Merge two or more BOMs") + { + new Option>("--input-files", "Input BOM filenames (separate filenames with a space).") { AllowMultipleArgumentsPerToken = true }, + new Option("--output-file", "Output BOM filename, will write to stdout if no value provided."), + new Option("--input-format", "Specify input file format."), + new Option("--output-format", "Specify output file format."), + new Option("--output-version", "Specify output BOM specification version."), + new Option("--hierarchical", "Perform a hierarchical merge."), + new Option("--group", "Provide the group of software the merged BOM describes."), + new Option("--name", "Provide the name of software the merged BOM describes (required for hierarchical merging)."), + new Option("--version", "Provide the version of software the merged BOM describes (required for hierarchical merging).") + }; subCommand.Handler = CommandHandler.Create(Merge); rootCommand.Add(subCommand); }