using Robust.Shared.Console; namespace Content.Shared.Commands; /// /// Helper functions for common command things. /// public static class CommandHelper { /// /// Check that there is exactly 1 input argument. Returns false and prints an error if not. /// public static bool CheckExactlyOneArgument(ILocalizationManager loc, IConsoleShell shell, string[] args) { if (args.Length != 1) { shell.WriteError(loc.GetString("shell-need-exactly-one-argument")); return false; } return true; } /// /// Parse an argument as boolean. Returns false and prints an error if not. /// public static bool ParseArgumentBoolean(ILocalizationManager loc, IConsoleShell shell, string value, out bool boolean) { if (!bool.TryParse(value, out boolean)) { shell.WriteError(loc.GetString("shell-invalid-bool-value", ("value", value))); return false; } return true; } }