Tweak CLI a bit more
This commit is contained in:
parent
f6243cb131
commit
fd740f5616
1 changed files with 8 additions and 2 deletions
|
@ -9,6 +9,7 @@ namespace MarkovGrams
|
||||||
{
|
{
|
||||||
public enum Mode
|
public enum Mode
|
||||||
{
|
{
|
||||||
|
None,
|
||||||
Help,
|
Help,
|
||||||
NGrams,
|
NGrams,
|
||||||
Markov,
|
Markov,
|
||||||
|
@ -19,6 +20,7 @@ namespace MarkovGrams
|
||||||
{
|
{
|
||||||
public static int Main(string[] args)
|
public static int Main(string[] args)
|
||||||
{
|
{
|
||||||
|
Mode mode = Mode.None;
|
||||||
List<string> extras = new List<string>();
|
List<string> extras = new List<string>();
|
||||||
StreamReader wordlistSource = new StreamReader(Console.OpenStandardInput());
|
StreamReader wordlistSource = new StreamReader(Console.OpenStandardInput());
|
||||||
int order = 3, length = 8, count = 10;
|
int order = 3, length = 8, count = 10;
|
||||||
|
@ -60,14 +62,17 @@ namespace MarkovGrams
|
||||||
case "start-uppercase":
|
case "start-uppercase":
|
||||||
startOnUppercase = true;
|
startOnUppercase = true;
|
||||||
break;
|
break;
|
||||||
|
case "help":
|
||||||
|
mode = Mode.Help;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
Console.Error.WriteLine($"Error: Unknown option '{args[i]}'.");
|
Console.Error.WriteLine($"Error: Unknown option '{args[i]}'.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(mode != Mode.Help && extras.Count > 0)
|
||||||
Mode mode = extras.Count > 0 ? (Mode)Enum.Parse(typeof(Mode), extras.ShiftAt(0).Replace("markov-w", "weightedmarkov"), true) : Mode.Help;
|
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(" Generate raw unique n-grams");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
Console.WriteLine("Available options:");
|
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(" --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(" --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)");
|
Console.WriteLine(" --length {number} The target length of word to generate (Not available in ngrams mode)");
|
||||||
|
|
Loading…
Reference in a new issue