Browse Source

Tweak CLI a bit more

master
Starbeamrainbowlabs 2 years ago
parent
commit
fd740f5616
Signed by: sbrl GPG Key ID: 1BE5172E637709C2
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      MarkovGrams/Program.cs

+ 8
- 2
MarkovGrams/Program.cs View File

@ -9,6 +9,7 @@ namespace MarkovGrams
{
public enum Mode
{
None,
Help,
NGrams,
Markov,
@ -19,6 +20,7 @@ namespace MarkovGrams
{
public static int Main(string[] args)
{
Mode mode = Mode.None;
List<string> extras = new List<string>();
StreamReader wordlistSource = new StreamReader(Console.OpenStandardInput());
int order = 3, length = 8, count = 10;
@ -60,14 +62,17 @@ namespace MarkovGrams
case "start-uppercase":
startOnUppercase = true;
break;
case "help":
mode = Mode.Help;
break;
default:
Console.Error.WriteLine($"Error: Unknown option '{args[i]}'.");
return 1;
}
}
Mode mode = extras.Count > 0 ? (Mode)Enum.Parse(typeof(Mode), extras.ShiftAt(0).Replace("markov-w", "weightedmarkov"), true) : Mode.Help;
if(mode != Mode.Help && extras.Count > 0)
mode = (Mode)Enum.Parse(typeof(Mode), extras.ShiftAt(0).Replace("markov-w", "weightedmarkov"), true);
// ------------------------------------------------------------------------------------------
@ -127,6 +132,7 @@ namespace MarkovGrams
Console.WriteLine(" Generate raw unique n-grams");
Console.WriteLine();
Console.WriteLine("Available options:");
Console.WriteLine(" --help Show this message");
Console.WriteLine(" --wordlist {filename} Read the wordlist from the specified filename instead of stdin");
Console.WriteLine(" --order {number} Use the specified order when generating n-grams (default: 3)");
Console.WriteLine(" --length {number} The target length of word to generate (Not available in ngrams mode)");


Loading…
Cancel
Save