2020-05-08 13:38:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
using CommandLine;
|
|
|
|
|
using treasurechest.STDIOWrapper;
|
2020-05-21 09:05:32 +00:00
|
|
|
|
using treasurechest;
|
2020-05-08 13:38:08 +00:00
|
|
|
|
|
2020-05-21 09:05:32 +00:00
|
|
|
|
namespace treasurechestCLI
|
2020-05-08 13:38:08 +00:00
|
|
|
|
{
|
|
|
|
|
class Program
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
static void Main(string[] args)
|
|
|
|
|
{
|
|
|
|
|
CommandLine.Parser.Default.ParseArguments<Options>(args)
|
|
|
|
|
.WithParsed(RunOptions);
|
|
|
|
|
}
|
|
|
|
|
static void RunOptions(Options opts)
|
|
|
|
|
{
|
|
|
|
|
bool command = true;
|
|
|
|
|
|
|
|
|
|
if (opts.Version){
|
2020-05-21 09:05:32 +00:00
|
|
|
|
STDIO.O(treasurechest.Version.NAME + " - " + treasurechest.Version.VERSION);
|
|
|
|
|
}
|
|
|
|
|
else if (opts.Menu){
|
|
|
|
|
new TreasureChestMenu().showMenu();
|
2020-05-08 13:38:08 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
command = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (! command){
|
2020-05-21 09:05:32 +00:00
|
|
|
|
STDIO.O(treasurechest.Version.NAME + " - " + treasurechest.Version.VERSION);
|
|
|
|
|
STDIO.O(new translations.Strings().HELP_TEXT);
|
2020-05-08 13:38:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class Options
|
|
|
|
|
{
|
|
|
|
|
[Option('i', "interactive", Required = false, HelpText = "Interactive STDIO usage")]
|
|
|
|
|
public bool Interactive { get; set; }
|
|
|
|
|
[Option('v', "version", Required = false, HelpText="Show current version")]
|
|
|
|
|
public bool Version {get; set;}
|
2020-05-21 09:05:32 +00:00
|
|
|
|
[Option('m', "menu", Required = false, HelpText="Interactive CLI menu")]
|
|
|
|
|
public bool Menu {get;set;}
|
2020-05-08 13:38:08 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|