Add ability to change the command line arg symbol
This commit is contained in:
parent
eeeb58f4e9
commit
353ca4b427
1 changed files with 8 additions and 2 deletions
|
@ -41,9 +41,10 @@ public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new CommandLine instance and set some internal variables.
|
/// Create a new CommandLine instance and set some internal variables.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public CommandLineCollection(string[] args)
|
public CommandLineCollection(string[] args, bool useTackInsteadOfSlash=false)
|
||||||
{
|
{
|
||||||
m_RawArgs = args;
|
m_RawArgs = args;
|
||||||
|
ArgSymbol = useTackInsteadOfSlash ? '-' : '/';
|
||||||
|
|
||||||
Parse();
|
Parse();
|
||||||
}
|
}
|
||||||
|
@ -84,7 +85,7 @@ public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
|
||||||
{
|
{
|
||||||
var arg = m_RawArgs[idx];
|
var arg = m_RawArgs[idx];
|
||||||
|
|
||||||
if (arg.Length > 2 && arg[0] == '/')
|
if (arg.Length > 2 && arg[0] == ArgSymbol)
|
||||||
{
|
{
|
||||||
arg = arg.Substring(1);
|
arg = arg.Substring(1);
|
||||||
lastArg = arg;
|
lastArg = arg;
|
||||||
|
@ -124,6 +125,11 @@ public class CommandLineCollection : IEnumerable<KeyValuePair<string, string>>
|
||||||
// The raw OS arguments
|
// The raw OS arguments
|
||||||
private readonly string[] m_RawArgs;
|
private readonly string[] m_RawArgs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Argument symbol for parsing
|
||||||
|
/// </summary>
|
||||||
|
private readonly char ArgSymbol;
|
||||||
|
|
||||||
// Command-line argument storage
|
// Command-line argument storage
|
||||||
private readonly Dictionary<string, string> m_Arguments = new();
|
private readonly Dictionary<string, string> m_Arguments = new();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue