Updates the commandline parser to not be broken.
It should now correctly parse a commandline such as `["", "-flag", "-flag", "arg" ... "etc" ]`
This commit is contained in:
parent
eda2870bb1
commit
c4129cf645
1 changed files with 7 additions and 1 deletions
|
|
@ -165,10 +165,16 @@ namespace TShockAPI.CLI
|
||||||
{
|
{
|
||||||
_source = source;
|
_source = source;
|
||||||
|
|
||||||
for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length - 1); i++)
|
for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length); i++)
|
||||||
{
|
{
|
||||||
string flag = source[i].ToLowerInvariant();
|
string flag = source[i].ToLowerInvariant();
|
||||||
string argument = null;
|
string argument = null;
|
||||||
|
|
||||||
|
if (string.IsNullOrWhiteSpace(flag))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (i + 1 < source.Length)
|
if (i + 1 < source.Length)
|
||||||
{
|
{
|
||||||
argument = source[i + 1];
|
argument = source[i + 1];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue