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() .Title("[cyan]Select a [yellow]day[/] to run:[/]") .AddChoices(days); var selectedDay = AnsiConsole.Prompt(select); AnsiConsole.MarkupLine($"[cyan]Running [yellow]{selectedDay}[/]...[/]\n"); AnsiConsole.MarkupLine("[cyan]Part [yellow]1[/] result:[/]"); selectedDay.RunPart1(); AnsiConsole.MarkupLine("\n[cyan]Part [yellow]2[/] result:[/]"); selectedDay.RunPart2();