Files
CliFx/CliFx.Tests.Dummy/Commands/LogCommand.cs
2019-06-02 18:32:25 +03:00

25 lines
691 B
C#

using System;
using System.Globalization;
using CliFx.Attributes;
using CliFx.Models;
namespace CliFx.Tests.Dummy.Commands
{
[Command("log")]
public class LogCommand : Command
{
[CommandOption("value", IsRequired = true, Description = "Value whose logarithm is to be found.")]
public double Value { get; set; }
[CommandOption("base", Description = "Logarithm base.")]
public double Base { get; set; } = 10;
public override ExitCode Execute()
{
var result = Math.Log(Value, Base);
Console.WriteLine(result.ToString(CultureInfo.InvariantCulture));
return ExitCode.Success;
}
}
}