tested and fixed new help structure

This commit is contained in:
Harrison Deng 2018-12-28 20:33:34 -06:00
parent 960bf76802
commit e137796b46
2 changed files with 23 additions and 17 deletions

View File

@ -138,7 +138,7 @@ namespace RecrownedAthenaeum.Tools.CommandProcessor
/// <returns>The string for the help.</returns>
public string Help(string argument = null)
{
if (arguments != null)
if (argument != null && arguments != null)
{
if (Validate(argument))
{
@ -149,25 +149,31 @@ namespace RecrownedAthenaeum.Tools.CommandProcessor
return "The argument " + argument + " does not exist. Type \"help " + invokeStrings[0] + "\" (or any of its aliases) for a list of arguments.";
}
}
else
{
StringBuilder helpBuilder = new StringBuilder();
helpBuilder.Append(help);
if (arguments != null)
{
helpBuilder.AppendLine();
helpBuilder.Append("Possible arguments are: ");
for (int i = 0; i < arguments.Length; i++)
{
helpBuilder.Append(arguments[i].invokeString);
if (i + 2 > arguments.Length)
if (i == arguments.Length - 2)
{
helpBuilder.Append(", and ");
}
else
else if (i < arguments.Length - 2)
{
helpBuilder.Append(", ");
}
}
helpBuilder.Append('.');
}
return helpBuilder.ToString();
}
}
}
}

View File

@ -21,7 +21,7 @@ namespace RecrownedAthenaeum.Tools.TextureAtlasTools
new EngineCommandArgument("-dau", "Disables automatically upscaling the texture."),
};
help = "Packs a given directory composed of png and jpg files into an atlas. Can also add 9patch properties. Runnig without arguments triggers interactive mode.";
help = "Packs a given directory composed of png and jpg files into an atlas. Can also add 9patch properties. Running without arguments triggers interactive mode.";
}
public override void Run(string[] arguments)