mirror of
https://github.com/spectreconsole/examples.git
synced 2025-10-25 15:19:18 +00:00
21 lines
414 B
C#
21 lines
414 B
C#
using System;
|
|
using Spectre.Console;
|
|
using Spectre.Console.Cli;
|
|
|
|
namespace Dynamic;
|
|
|
|
public sealed class MyCommand : Command
|
|
{
|
|
public override int Execute(CommandContext context)
|
|
{
|
|
if (!(context.Data is int data))
|
|
{
|
|
throw new InvalidOperationException("Command has no associated data.");
|
|
|
|
}
|
|
|
|
AnsiConsole.WriteLine("Value = {0}", data);
|
|
return 0;
|
|
}
|
|
}
|