mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00

* Renames Spectre.Cli to Spectre.Console.Cli. * Now uses Verify with Spectre.Console.Cli tests. * Removes some duplicate definitions. Closes #168
21 lines
453 B
C#
21 lines
453 B
C#
using System;
|
|
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.");
|
|
|
|
}
|
|
|
|
Console.WriteLine("Value = {0}", data);
|
|
return 0;
|
|
}
|
|
}
|
|
}
|