mirror of
https://git.lewd.wtf/PGR/ascnet
synced 2025-12-13 08:44:37 +01:00
slightly improve help
This commit is contained in:
@@ -91,12 +91,13 @@ namespace AscNet.GameServer.Commands
|
|||||||
{
|
{
|
||||||
List<PropertyInfo> argsProperties = cmd.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Where(x => x.GetCustomAttribute(typeof(ArgumentAttribute)) is not null).ToList();
|
List<PropertyInfo> argsProperties = cmd.GetType().GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).Where(x => x.GetCustomAttribute(typeof(ArgumentAttribute)) is not null).ToList();
|
||||||
|
|
||||||
helpText += $"{command} {string.Join(" ", argsProperties.Select(x => $"<{x.Name}>"))}\n└─{cmd.Help}\n";
|
helpText += $"{command} {string.Join(" ", argsProperties.Select(x => $"<{x.Name}>"))}\n{cmd.Help}\n";
|
||||||
foreach (var argProp in argsProperties)
|
foreach (var argProp in argsProperties)
|
||||||
{
|
{
|
||||||
ArgumentAttribute attr = (ArgumentAttribute)argProp.GetCustomAttribute(typeof(ArgumentAttribute))!;
|
ArgumentAttribute attr = (ArgumentAttribute)argProp.GetCustomAttribute(typeof(ArgumentAttribute))!;
|
||||||
helpText += string.Format($"└─{argProp.Name} \"{attr.Pattern}\"{{0}}\n", string.IsNullOrEmpty(attr.Description) ? string.Empty : $", {attr.Description}");
|
helpText += string.Format($"└{argProp.Name} \"{attr.Pattern}\"{{0}}\n", string.IsNullOrEmpty(attr.Description) ? string.Empty : $", {attr.Description}");
|
||||||
}
|
}
|
||||||
|
helpText += '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user