Skip to content

Commit

Permalink
adding a sub-command
Browse files Browse the repository at this point in the history
  • Loading branch information
lavedon committed Jun 20, 2021
1 parent 42b06c3 commit 45df790
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ static void Main(string[] args)
new Option<string?>(new[] {"--part-of-speech", "-ps"}, description: "Only return results to words specific parts of speech"),
new Option<string?>(new[] {"--years", "-y"}, description: "Years. Use format 900-1999 or -1999 or 900-. Used for first recorded, last recorded, and current in."),
new Option<bool>(new[] {"--current-in", "-c"} , description: "Flag which sets the 'Years' option to work with current in year - as opposed to recorded in year - Restrict results to words current in this year or period. Works with the Years flag. i.e. -y 280-1900 -c another example: -y 500 -c will return the words current in the year 500 AD."),

new Option<bool>(new[] {"--revised", "-r"}, description: "Restrict words taken from new and revised OED entries (OED-3rd edition content)"),
new Option<bool>(new[] {"--revised-not", "-rn"}, description: "Restrict to non revised sources only. (OED 2nd and 1rst edition)"),
new Option<string?>(new[] {"--etymology-language", "-el"}, description: "Restrict results to words derived from a certain language. Languages are grouped by continent and hierarchical. i.e. European will automatically include German."),
new Option<string?>(new[] {"--etymology-type", "-et"}, description: "Restrict results only certain etymological types. compound, derivative, conversion, blend, shortening, backformation, initialism, acronym, variant, arbitrary, imitative, borrowing, properName, unknown")
};

rootCommand.Description = "An app which processes the Oxford English Dictionary Researcher API, and exports to SuperMemo.";
rootCommand.Handler = CommandHandler.Create<string, bool, bool, string?, string?, bool>(HandleArgs);
rootCommand.Handler = CommandHandler.Create<string, bool, bool, string?, string?, bool, bool, bool, string?, string?>(HandleArgs);


string directoryPath = string.Concat(Environment.CurrentDirectory, "\\logs");
Expand Down Expand Up @@ -78,14 +81,18 @@ static void Main(string[] args)

}

public static void HandleArgs(string word, bool obsoleteOnly, bool obsoleteExclude, string? partOfSpeech, string? years, bool currentIn)
public static void HandleArgs(string word, bool obsoleteOnly, bool obsoleteExclude, string? partOfSpeech, string? years, bool currentIn, bool revised, bool revisedNot, string? etymologyLanguage, string? etymologyType)
{
Console.WriteLine($"CLI word entered was {word}");
Console.WriteLine($"obsoleteOnlyOption: {obsoleteOnly}");
Console.WriteLine($"excludeObsoleteOption: {obsoleteExclude}.");
Console.WriteLine($"partOfSpeech: {partOfSpeech ?? "null"}");
Console.WriteLine($"years: {years ?? "null"}");
Console.WriteLine($"Current In: {currentIn}");
Console.WriteLine($"Revised:? {revised}");
Console.WriteLine($"Revised: Old editions only? {revisedNot}");
Console.WriteLine($"etymologyLanguage: {etymologyLanguage}");
Console.WriteLine($"etymologyType: {etymologyType}");

Console.ReadLine();
CurrentQuery query = new();
Expand Down
Binary file modified bin/Debug/net5.0/OxfordV2.dll
Binary file not shown.
Binary file modified bin/Debug/net5.0/OxfordV2.pdb
Binary file not shown.
Binary file modified bin/Debug/net5.0/ref/OxfordV2.dll
Binary file not shown.
Binary file modified obj/Debug/net5.0/OxfordV2.dll
Binary file not shown.
Binary file modified obj/Debug/net5.0/OxfordV2.pdb
Binary file not shown.
Binary file modified obj/Debug/net5.0/ref/OxfordV2.dll
Binary file not shown.

0 comments on commit 45df790

Please sign in to comment.