add more helpful `help` command output
This commit is contained in:
parent
51de495ae4
commit
c6b40fb591
|
@ -11,6 +11,7 @@
|
|||
* For players:
|
||||
* Reduced memory usage.
|
||||
* You can now enter console commands for a specific screen in split-screen mode by adding `screen=ID` to the command.
|
||||
* Typing `help` in the SMAPI console is now more friendly and helpful.
|
||||
|
||||
* For modders:
|
||||
* Simplified tilesheet order warning added in 3.8.2.
|
||||
|
|
|
@ -210,6 +210,7 @@ namespace StardewModdingAPI.Web
|
|||
[@"^/community\.?$"] = "https://stardewvalleywiki.com/Modding:Community",
|
||||
[@"^/compat\.?$"] = "https://smapi.io/mods",
|
||||
[@"^/docs\.?$"] = "https://stardewvalleywiki.com/Modding:Index",
|
||||
[@"^/help\.?$"] = "https://stardewvalleywiki.com/Modding:Help",
|
||||
[@"^/install\.?$"] = "https://stardewvalleywiki.com/Modding:Player_Guide/Getting_Started#Install_SMAPI",
|
||||
[@"^/troubleshoot(.*)$"] = "https://stardewvalleywiki.com/Modding:Player_Guide/Troubleshooting$1",
|
||||
[@"^/xnb\.?$"] = "https://stardewvalleywiki.com/Modding:Using_XNB_mods"
|
||||
|
|
|
@ -41,13 +41,26 @@ namespace StardewModdingAPI.Framework.Commands
|
|||
{
|
||||
Command result = this.CommandManager.Get(args[0]);
|
||||
if (result == null)
|
||||
monitor.Log("There's no command with that name.", LogLevel.Error);
|
||||
monitor.Log("There's no command with that name. Type 'help' by itself for more info.", LogLevel.Error);
|
||||
else
|
||||
monitor.Log($"{result.Name}: {result.Documentation}{(result.Mod != null ? $"\n(Added by {result.Mod.DisplayName}.)" : "")}", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = "The following commands are registered:\n";
|
||||
string message =
|
||||
"\n\n"
|
||||
+ "Need help with a SMAPI or mod issue?\n"
|
||||
+ "------------------------------------\n"
|
||||
+ "See https://smapi.io/help for the best places to ask.\n\n\n"
|
||||
+ "How commands work\n"
|
||||
+ "-----------------\n"
|
||||
+ "Just enter a command directly to run it, just like you did for this help command. Commands may take optional arguments\n"
|
||||
+ "which change what they do; for example, type 'help help' to see help about the help command. When playing in split-screen\n"
|
||||
+ "mode, you can add screen=X to send the command to a specific screen instance.\n\n\n"
|
||||
+ "Valid commands\n"
|
||||
+ "--------------\n"
|
||||
+ "The following commands are registered. For more info about a command, type 'help command_name'.\n\n";
|
||||
|
||||
IGrouping<string, string>[] groups = (from command in this.CommandManager.GetAll() orderby command.Mod?.DisplayName, command.Name group command.Name by command.Mod?.DisplayName).ToArray();
|
||||
foreach (var group in groups)
|
||||
{
|
||||
|
@ -55,7 +68,6 @@ namespace StardewModdingAPI.Framework.Commands
|
|||
string[] commandNames = group.ToArray();
|
||||
message += $"{modName}:\n {string.Join("\n ", commandNames)}\n\n";
|
||||
}
|
||||
message += "For more information about a command, type 'help command_name'.";
|
||||
|
||||
monitor.Log(message, LogLevel.Info);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue