18 lines
558 B
C#
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(); |