From e137796b460f664f3b6a6d64c171bf3227946e94 Mon Sep 17 00:00:00 2001 From: Harrison Deng Date: Fri, 28 Dec 2018 20:33:34 -0600 Subject: [PATCH] tested and fixed new help structure --- .../CommandProcessor/EngineCommand.cs | 38 +++++++++++-------- .../TextureAtlasTools/TexturePackerCommand.cs | 2 +- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/EngineCommand.cs b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/EngineCommand.cs index b24cf89..2fd9d27 100644 --- a/RecrownedAthenaeum.ConsoleTools/CommandProcessor/EngineCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/CommandProcessor/EngineCommand.cs @@ -138,7 +138,7 @@ namespace RecrownedAthenaeum.Tools.CommandProcessor /// The string for the help. 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."; } } - - StringBuilder helpBuilder = new StringBuilder(); - helpBuilder.Append(help); - helpBuilder.AppendLine(); - helpBuilder.Append("Possible arguments are: "); - for (int i = 0; i < arguments.Length; i++) + else { - helpBuilder.Append(arguments[i].invokeString); - if (i + 2 > arguments.Length) + StringBuilder helpBuilder = new StringBuilder(); + helpBuilder.Append(help); + if (arguments != null) { - helpBuilder.Append(", and "); - } - else - { - helpBuilder.Append(", "); + helpBuilder.AppendLine(); + helpBuilder.Append("Possible arguments are: "); + for (int i = 0; i < arguments.Length; i++) + { + helpBuilder.Append(arguments[i].invokeString); + if (i == arguments.Length - 2) + { + helpBuilder.Append(", and "); + } + else if (i < arguments.Length - 2) + { + helpBuilder.Append(", "); + } + } + helpBuilder.Append('.'); } + return helpBuilder.ToString(); } - helpBuilder.Append('.'); - return helpBuilder.ToString(); + } } } diff --git a/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs b/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs index 45313bd..035efcc 100644 --- a/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs +++ b/RecrownedAthenaeum.ConsoleTools/TextureAtlasTools/TexturePackerCommand.cs @@ -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)