Added -dump switch which dumps permissions/config options
Dumps are now alphabetical.
This commit is contained in:
parent
bf238768b4
commit
ab65c30ce6
3 changed files with 10 additions and 5 deletions
|
|
@ -236,12 +236,12 @@ namespace TShockAPI
|
|||
public static Action<ConfigFile> ConfigRead;
|
||||
|
||||
|
||||
private static void DumpDescriptions()
|
||||
public static void DumpDescriptions()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var defaults = new ConfigFile();
|
||||
|
||||
foreach (var field in defaults.GetType().GetFields())
|
||||
foreach (var field in defaults.GetType().GetFields().OrderBy(f => f.Name))
|
||||
{
|
||||
if (field.IsStatic)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -148,10 +148,10 @@ namespace TShockAPI
|
|||
return Commands.ChatCommands.Where(c => c.Permission == perm).ToList();
|
||||
}
|
||||
|
||||
private static void DumpDescriptions()
|
||||
public static void DumpDescriptions()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
foreach (var field in typeof (Permissions).GetFields())
|
||||
foreach (var field in typeof(Permissions).GetFields().OrderBy(f => f.Name))
|
||||
{
|
||||
var name = field.Name;
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ namespace TShockAPI
|
|||
c =>
|
||||
c.Name + (c.Names.Count > 1 ? "({0})".SFormat(string.Join(" ", c.Names.ToArray(), 1, c.Names.Count - 1)) : ""));
|
||||
|
||||
sb.AppendLine("## <a name=\"{0}\">{0} ".SFormat(name));
|
||||
sb.AppendLine("## <a name=\"{0}\">{0}</a> ".SFormat(name));
|
||||
sb.AppendLine("**Description:** {0} ".SFormat(desc));
|
||||
sb.AppendLine("**Commands:** {0} ".SFormat(strs.Count() > 0 ? string.Join(" ", strs) : "None"));
|
||||
sb.AppendLine();
|
||||
|
|
|
|||
|
|
@ -357,6 +357,11 @@ namespace TShockAPI
|
|||
Log.ConsoleInfo("World path has been set to " + path);
|
||||
}
|
||||
}
|
||||
if (parms[i].ToLower() == "-dump")
|
||||
{
|
||||
ConfigFile.DumpDescriptions();
|
||||
Permissions.DumpDescriptions();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue