summaryrefslogtreecommitdiff
path: root/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-13 22:06:07 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-13 22:06:07 -0400
commit2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15 (patch)
tree3b97dd4aa6e9b7971dafa139c64a39c31e841fe6 /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
parentaa7b0caf4656d65ee156c3cf5ea786f561b850bb (diff)
downloadSMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.tar.gz
SMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.tar.bz2
SMAPI-2765e3f9b379f0dc2a5732c1ca9ba23dbe2a7f15.zip
enable nullable annotations in bundled mods (#837)
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs')
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
index 8fcbf711..66f2f105 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
@@ -1,8 +1,7 @@
-#nullable disable
-
using System;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
@@ -54,7 +53,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
/// <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 (case-insensitive).</param>
- public bool TryGet(int index, string name, out string value, bool required = true, string[] oneOf = null)
+ public bool TryGet(int index, string name, [NotNullWhen(true)] out string? value, bool required = true, string[]? oneOf = null)
{
value = null;
@@ -88,7 +87,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
value = 0;
// get argument
- if (!this.TryGet(index, name, out string raw, required))
+ if (!this.TryGet(index, name, out string? raw, required))
return false;
// parse