mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
24 lines
781 B
C#
24 lines
781 B
C#
using System.Threading.Tasks;
|
|
using CliFx.Attributes;
|
|
|
|
namespace CliFx.Tests.TestCommands
|
|
{
|
|
[Command("div", Description = "Divide one number by another.")]
|
|
public class DivideCommand : ICommand
|
|
{
|
|
[CommandOption("dividend", 'D', IsRequired = true, Description = "The number to divide.")]
|
|
public double Dividend { get; set; }
|
|
|
|
[CommandOption("divisor", 'd', IsRequired = true, Description = "The number to divide by.")]
|
|
public double Divisor { get; set; }
|
|
|
|
// This property should be ignored by resolver
|
|
public bool NotAnOption { get; set; }
|
|
|
|
public ValueTask ExecuteAsync(IConsole console)
|
|
{
|
|
console.Output.WriteLine(Dividend / Divisor);
|
|
return default;
|
|
}
|
|
}
|
|
} |