diff --git a/WetPancakeCLI/ConsoleCommands.cs b/WetPancakeCLI/ConsoleCommands.cs index 72959d6..b989ded 100644 --- a/WetPancakeCLI/ConsoleCommands.cs +++ b/WetPancakeCLI/ConsoleCommands.cs @@ -45,11 +45,11 @@ namespace WetPancakeCLI #region Wet Pancake Utilities [ListCommand] + [Parameters("sentences: int, text: string")] [Description( "Checks to see if the string matches the desired sentence count and removes any over that limit.\n" + "If the string has less sentences than the number requested, it will not change.\n" + "Sentences must be greater than 0 and text must contain at least 1 \".\" \"?\" \"!\"")] - [Parameters("sentences: int, text: string")] [Usage("> CleanText 1 \"This is a test sentence. And, this one needs to be removed.\"")] public static string CleanText(int sentences, string text) { @@ -124,6 +124,7 @@ namespace WetPancakeCLI #region Text Generation [ListCommand] + [Parameters("gibberish-level: int, sentences: int, copy-to-clip-board: bool")] [Description( "Generates text using the gibberish-level and number of sentences specified by the user.\n" + "The result goes through an extra \"cleaning\" process to remove any artefact sentences.\n" + @@ -133,8 +134,10 @@ namespace WetPancakeCLI "Sentences must be greater than 0.\n" + "Pass in \"true\" to copy the result straight to the clipboard.\n" + "Pass in \"false\" or leave blank to not copy the result.")] - [Parameters("gibberish-level: int, sentences: int, copy-to-clip-board: bool")] - [Usage("> GenerateCleanText 5 10 true | > GenerateCleanText 5 4")] + [Usage("\n" + // Added because Console.Waterworks' rendering makes it look weird. + "> GenerateCleanText 5 10 true\n" + + "> GenerateCleanText 5 4 false \n" + + "> GenerateCleanText 5 4")] public static string GenerateCleanText(int gibberishLevel, int sentences, bool copyToClipboard = false) { try @@ -159,16 +162,23 @@ namespace WetPancakeCLI } [ListCommand] - [Description( - "Loads the specified .txt file and generates text based on it," + + [Parameters("gibberish-level: int, sentences: int, file path: string, copy-to-clip-board: bool")] + [Description("\n" + + "Loads the specified .txt file and generates text based on it,\n" + "using the gibberish-level and number of sentences specified by the user.\n" + "The result goes through an extra \"cleaning\" process to remove any artefact sentences.\n" + "Use this if you cannot tolerate the odd extra sentence.\n" + "With that said, it does mean it is slower than its GenerateTextFromFile counterpart.\n" + - "Gibberish-level must be between 2 and 20.")] - [Parameters("gibberish-level: int, sentences: int, file path: string")] - [Usage("> GenerateCleanTextFromFile 3 6 C:/yourfile.txt")] - public static string GenerateCleanTextFromFile(int gibberishLevel, int sentences, string filePath) + "Gibberish-level must be between 2 and 20.\n" + + "Sentences must be greater than 0.\n" + + "Pass in \"true\" to copy the result straight to the clipboard.\n" + + "Pass in \"false\" or leave blank to not copy the result.")] + [Usage("\n" + // Added because Console.Waterworks' rendering makes it look weird. + "> GenerateCleanTextFromFile 3 6 C:/yourfile.txt true \n" + + "> GenerateCleanTextFromFile 5 9 C:/yourfile.txt false\n" + + "> GenerateCleanTextFromFile 5 9 C:/ yourfile.txt")] + public static string GenerateCleanTextFromFile( + int gibberishLevel, int sentences, string filePath, bool copyToClipboard = false) { try { @@ -182,8 +192,12 @@ namespace WetPancakeCLI if (string.Equals(extension, ".txt") != true) throw new FileLoadException ("The file entered is not a plain text (.txt) file.", filePath); - return FSharpAsync.StartAsTask - (RequestCleanTextFromFileAsync(gibberishLevel, sentences, filePath), _taskCreationOptions, _cancellationToken).Result; + var result = FSharpAsync.StartAsTask( + RequestCleanTextFromFileAsync(gibberishLevel, sentences, filePath), + _taskCreationOptions, _cancellationToken) + .Result; + if (copyToClipboard == true) CopyToClipBoard(result); + return result; } catch (Exception e) { @@ -197,7 +211,10 @@ namespace WetPancakeCLI "Generates random text, the number of sentences generated is randomly determined\n." + "Pass in true to copy result straight to clipboard.")] [Parameters("copy-to-clipboard: bool")] - [Usage("> GenerateRandomText")] + [Usage("\n" + // Added because Console.Waterworks' rendering makes it look weird. + "> GenerateRandomText true\n" + + "> GenerateRandomText false\n" + + "> GenerateRandomText")] public static string GenerateRandomText(bool copyToClipboard = false) { try