diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-13 00:40:33 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-02-13 00:40:33 -0500 |
commit | 0441d0843c65775bc72377e32ed4b3b5ee0b8f75 (patch) | |
tree | ca2f098e04c968ef3bee32ce7900c68b868d17d2 /src/StardewModdingAPI/ICommandHelper.cs | |
parent | d1080a8b2b54c777a446f08d9ecd5b76b4b2561a (diff) | |
download | SMAPI-0441d0843c65775bc72377e32ed4b3b5ee0b8f75.tar.gz SMAPI-0441d0843c65775bc72377e32ed4b3b5ee0b8f75.tar.bz2 SMAPI-0441d0843c65775bc72377e32ed4b3b5ee0b8f75.zip |
add new console command API with backward compatibility (#199)
Diffstat (limited to 'src/StardewModdingAPI/ICommandHelper.cs')
-rw-r--r-- | src/StardewModdingAPI/ICommandHelper.cs | 26 |
1 files changed, 26 insertions, 0 deletions
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 +{ + /// <summary>Provides an API for managing console commands.</summary> + public interface ICommandHelper + { + /********* + ** Public methods + *********/ + /// <summary>Add a console command.</summary> + /// <param name="name">The command name, which the user must type to trigger it.</param> + /// <param name="documentation">The human-readable documentation shown when the player runs the built-in 'help' command.</param> + /// <param name="callback">The method to invoke when the command is triggered. This method is passed the command name and arguments submitted by the user.</param> + /// <exception cref="ArgumentNullException">The <paramref name="name"/> or <paramref name="callback"/> is null or empty.</exception> + /// <exception cref="FormatException">The <paramref name="name"/> is not a valid format.</exception> + /// <exception cref="ArgumentException">There's already a command with that name.</exception> + ICommandHelper Add(string name, string documentation, Action<string, string[]> callback); + + /// <summary>Trigger a command.</summary> + /// <param name="name">The command name.</param> + /// <param name="arguments">The command arguments.</param> + /// <returns>Returns whether a matching command was triggered.</returns> + bool Trigger(string name, string[] arguments); + } +} |