From 353ca4b4270decefced32ec84ab4a4cffee93d3f Mon Sep 17 00:00:00 2001 From: Zontreck Date: Sat, 7 Oct 2023 18:51:28 -0700 Subject: [PATCH] Add ability to change the command line arg symbol --- .../Prebuild/Core/Utilities/CommandLineCollection.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/Prebuild/Core/Utilities/CommandLineCollection.cs b/source/Prebuild/Core/Utilities/CommandLineCollection.cs index 4485197..8bf9d63 100644 --- a/source/Prebuild/Core/Utilities/CommandLineCollection.cs +++ b/source/Prebuild/Core/Utilities/CommandLineCollection.cs @@ -41,9 +41,10 @@ public class CommandLineCollection : IEnumerable> /// /// Create a new CommandLine instance and set some internal variables. /// - public CommandLineCollection(string[] args) + public CommandLineCollection(string[] args, bool useTackInsteadOfSlash=false) { m_RawArgs = args; + ArgSymbol = useTackInsteadOfSlash ? '-' : '/'; Parse(); } @@ -84,7 +85,7 @@ public class CommandLineCollection : IEnumerable> { var arg = m_RawArgs[idx]; - if (arg.Length > 2 && arg[0] == '/') + if (arg.Length > 2 && arg[0] == ArgSymbol) { arg = arg.Substring(1); lastArg = arg; @@ -124,6 +125,11 @@ public class CommandLineCollection : IEnumerable> // The raw OS arguments private readonly string[] m_RawArgs; + /// + /// Argument symbol for parsing + /// + private readonly char ArgSymbol; + // Command-line argument storage private readonly Dictionary m_Arguments = new();