summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/Commands/ArgumentParser.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 18:17:20 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-07-02 18:17:20 -0400
commitf904b3da9728ee51c76e95915b78623a7638de26 (patch)
tree31b20846e8b65567c5d18520cd12e1de004671e8 /src/TrainerMod/Framework/Commands/ArgumentParser.cs
parent40e8d3da0e204117d0a6de91b368ef420eb31df0 (diff)
downloadSMAPI-f904b3da9728ee51c76e95915b78623a7638de26.tar.gz
SMAPI-f904b3da9728ee51c76e95915b78623a7638de26.tar.bz2
SMAPI-f904b3da9728ee51c76e95915b78623a7638de26.zip
add unified player_add command which adds any item type (#302)
Diffstat (limited to 'src/TrainerMod/Framework/Commands/ArgumentParser.cs')
-rw-r--r--src/TrainerMod/Framework/Commands/ArgumentParser.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/TrainerMod/Framework/Commands/ArgumentParser.cs b/src/TrainerMod/Framework/Commands/ArgumentParser.cs
index bce068f1..6bcd3ff8 100644
--- a/src/TrainerMod/Framework/Commands/ArgumentParser.cs
+++ b/src/TrainerMod/Framework/Commands/ArgumentParser.cs
@@ -1,4 +1,5 @@
-using System.Collections;
+using System;
+using System.Collections;
using System.Collections.Generic;
using System.Linq;
using StardewModdingAPI;
@@ -58,7 +59,7 @@ namespace TrainerMod.Framework.Commands
/// <param name="name">The argument name for error messages.</param>
/// <param name="value">The parsed value.</param>
/// <param name="required">Whether to show an error if the argument is missing.</param>
- /// <param name="oneOf">Require that the argument match one of the given values.</param>
+ /// <param name="oneOf">Require that the argument match one of the given values (case-insensitive).</param>
public bool TryGet(int index, string name, out string value, bool required = true, string[] oneOf = null)
{
value = null;
@@ -70,7 +71,7 @@ namespace TrainerMod.Framework.Commands
this.LogError($"Argument {index} ({name}) is required.");
return false;
}
- if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index]))
+ if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.InvariantCultureIgnoreCase))
{
this.LogError($"Argument {index} ({name}) must be one of {string.Join(", ", oneOf)}.");
return false;