Files
CliFx/CliFx.Tests/TestCommands/ConcatCommand.cs
2019-10-30 18:37:32 +02:00

24 lines
774 B
C#

using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using CliFx.Attributes;
using CliFx.Services;
namespace CliFx.Tests.TestCommands
{
[Command("concat", Description = "Concatenate strings.")]
public class ConcatCommand : ICommand
{
[CommandOption('i', IsRequired = true, Description = "Input strings.")]
public IReadOnlyList<string> Inputs { get; set; }
[CommandOption('s', Description = "String separator.")]
public string Separator { get; set; } = "";
public Task ExecuteAsync(IConsole console, CancellationToken cancellationToken)
{
console.Output.WriteLine(string.Join(Separator, Inputs));
return Task.CompletedTask;
}
}
}