mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Merge pull request #209 from Aireil/add_commands_help
Add commands in plugin descriptions
This commit is contained in:
commit
96c9ba0af3
2 changed files with 14 additions and 0 deletions
|
|
@ -1,3 +1,5 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace Dalamud.Game.Command {
|
||||
/// <summary>
|
||||
/// This class describes a registered command.
|
||||
|
|
@ -31,6 +33,9 @@ namespace Dalamud.Game.Command {
|
|||
/// <param name="handler"></param>
|
||||
public CommandInfo(HandlerDelegate handler) {
|
||||
Handler = handler;
|
||||
}
|
||||
LoaderAssemblyName = Assembly.GetCallingAssembly()?.GetName()?.Name;
|
||||
}
|
||||
|
||||
internal string LoaderAssemblyName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,6 +229,15 @@ namespace Dalamud.Plugin
|
|||
x => x.Definition.InternalName ==
|
||||
pluginDefinition.InternalName);
|
||||
|
||||
if (this.dalamud.CommandManager.Commands.Any(x => x.Value.LoaderAssemblyName == installedPlugin.Definition?.InternalName)) {
|
||||
ImGui.Dummy(new Vector2(10, 10) * ImGui.GetIO().FontGlobalScale);
|
||||
foreach (var command in this.dalamud.CommandManager.Commands) {
|
||||
if (command.Value.LoaderAssemblyName == installedPlugin.Definition.InternalName && command.Value.ShowInHelp) {
|
||||
ImGui.Text($"{command.Key} → {command.Value.HelpMessage}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ImGui.Button(Loc.Localize("InstallerDisable", "Disable")))
|
||||
try {
|
||||
this.dalamud.PluginManager.DisablePlugin(installedPlugin.Definition);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue