Files
AdventOfCode/Program.cs
2022-12-05 11:02:18 +01:00

18 lines
558 B
C#

using System.Reflection;
using AdventOfCode.Days;
using Spectre.Console;
var days = Assembly.GetAssembly(typeof(Day))!.GetTypes()
.Where(t => t.IsAssignableTo(typeof(Day)) && t.GetConstructor(Type.EmptyTypes) != null && !t.IsAbstract)
.Select(t => (Day)Activator.CreateInstance(t)!);
var select = new SelectionPrompt<Day>()
.Title("[cyan]Select a [yellow]day[/] to run:[/]")
.AddChoices(days);
var selectedDay = AnsiConsole.Prompt(select);
AnsiConsole.MarkupLine($"[cyan]Running [yellow]{selectedDay}[/]...[/]\n");
selectedDay.Run();