From 0441d0843c65775bc72377e32ed4b3b5ee0b8f75 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 13 Feb 2017 00:40:33 -0500 Subject: add new console command API with backward compatibility (#199) --- src/StardewModdingAPI/ICommandHelper.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/StardewModdingAPI/ICommandHelper.cs (limited to 'src/StardewModdingAPI/ICommandHelper.cs') diff --git a/src/StardewModdingAPI/ICommandHelper.cs b/src/StardewModdingAPI/ICommandHelper.cs new file mode 100644 index 00000000..3a51ffb4 --- /dev/null +++ b/src/StardewModdingAPI/ICommandHelper.cs @@ -0,0 +1,26 @@ +using System; + +namespace StardewModdingAPI +{ + /// Provides an API for managing console commands. + public interface ICommandHelper + { + /********* + ** Public methods + *********/ + /// Add a console command. + /// The command name, which the user must type to trigger it. + /// The human-readable documentation shown when the player runs the built-in 'help' command. + /// The method to invoke when the command is triggered. This method is passed the command name and arguments submitted by the user. + /// The or is null or empty. + /// The is not a valid format. + /// There's already a command with that name. + ICommandHelper Add(string name, string documentation, Action callback); + + /// Trigger a command. + /// The command name. + /// The command arguments. + /// Returns whether a matching command was triggered. + bool Trigger(string name, string[] arguments); + } +} -- cgit