-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDescribeCommand.cs
More file actions
36 lines (32 loc) · 1.32 KB
/
Copy pathDescribeCommand.cs
File metadata and controls
36 lines (32 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Spectre.Console;
using Spectre.Console.Cli;
using System;
using System.ComponentModel;
using System.Threading;
namespace LabyrinthGenerator;
internal sealed class DescribeCommand : Command<DescribeCommand.Settings>
{
public sealed class Settings : CommandSettings
{
[CommandArgument(0, "<generator name>")]
[Description("The name of generator to be described")]
public AvailableGenerators Generator { get; init; }
}
protected override int Execute(CommandContext context, Settings settings, CancellationToken cancellationToken)
{
switch(settings.Generator)
{
case AvailableGenerators.Extruder:
AnsiConsole.WriteLine("Extruder generator is a generator that makes a random main path " +
"and extrudes dead ends from it. Uses complexity to define the count of dead ends.");
break;
case AvailableGenerators.MazeCE:
AnsiConsole.WriteLine("MazeCE is the Maze cellular automaton. It doesn't generate " +
"a real valid labyrinth (with both enter and exit). It is only a labyrinth parody.");
break;
default:
throw new InvalidEnumArgumentException($"Unknown generator type {settings.Generator}!");
}
return 0;
}
}