treasurechest/cli/Program.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2020-05-08 13:38:08 +00:00
using System;
using CommandLine;
using treasurechest.STDIOWrapper;
using treasurechest;
2020-05-08 13:38:08 +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){
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){
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;}
[Option('m', "menu", Required = false, HelpText="Interactive CLI menu")]
public bool Menu {get;set;}
2020-05-08 13:38:08 +00:00
}
}