Browse Source

Add Copy ToClipboard functionality to GenerateCleanText command-methods.

master
Craig Oates 6 years ago
parent
commit
f095bc004e
  1. 20
      WetPancakeCLI/ConsoleCommands.cs

20
WetPancakeCLI/ConsoleCommands.cs

@ -129,10 +129,13 @@ namespace WetPancakeCLI
"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 GenerateText counterpart.\n" +
"Gibberish-level must be between 2 and 20.")]
[Parameters("gibberish-level: int, sentences: int")]
[Usage("> GenerateCleanText 5 10")]
public static string GenerateCleanText(int gibberishLevel, int sentences)
"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.")]
[Parameters("gibberish-level: int, sentences: int, copy-to-clip-board: bool")]
[Usage("> GenerateCleanText 5 10 true | > GenerateCleanText 5 4")]
public static string GenerateCleanText(int gibberishLevel, int sentences, bool copyToClipboard = false)
{
try
{
@ -142,8 +145,11 @@ namespace WetPancakeCLI
if (sentences < 1)
throw new ArgumentException
("Invalid argument. Must be greater than 0.", "sentences");
return FSharpAsync.StartAsTask
(RequestCleanTextAsync(gibberishLevel, sentences), _taskCreationOptions, _cancellationToken).Result;
var result = FSharpAsync.StartAsTask(
RequestCleanTextAsync(gibberishLevel, sentences), _taskCreationOptions, _cancellationToken)
.Result;
if (copyToClipboard == true) CopyToClipBoard(result);
return result;
}
catch (Exception e)
{
@ -190,7 +196,7 @@ namespace WetPancakeCLI
[Description(
"Generates random text, the number of sentences generated is randomly determined\n." +
"Pass in true to copy result straight to clipboard.")]
[Parameters("copy-to-clipbaord: bool")]
[Parameters("copy-to-clipboard: bool")]
[Usage("> GenerateRandomText")]
public static string GenerateRandomText(bool copyToClipboard = false)
{

Loading…
Cancel
Save