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

* Add "Shared" projects for all examples * Update "Colors" example with better TrueColor demo * Use same namespace for all examples
21 lines
474 B
C#
21 lines
474 B
C#
using System;
|
|
using Spectre.Console.Cli;
|
|
|
|
namespace Spectre.Console.Examples
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
}
|