mirror of
https://github.com/Tyrrrz/CliFx.git
synced 2025-10-25 15:19:17 +00:00
31 lines
787 B
C#
31 lines
787 B
C#
using System;
|
|
using System.Text;
|
|
using CliFx.Attributes;
|
|
using CliFx.Models;
|
|
|
|
namespace CliFx.Tests.Dummy.Commands
|
|
{
|
|
[DefaultCommand]
|
|
public class DefaultCommand : Command
|
|
{
|
|
[CommandOption("target", 't', Description = "Greeting target.")]
|
|
public string Target { get; set; } = "world";
|
|
|
|
[CommandOption('e', Description = "Whether the greeting should be enthusiastic.")]
|
|
public bool IsEnthusiastic { get; set; }
|
|
|
|
public override ExitCode Execute()
|
|
{
|
|
var buffer = new StringBuilder();
|
|
|
|
buffer.Append("Hello ").Append(Target);
|
|
|
|
if (IsEnthusiastic)
|
|
buffer.Append("!!!");
|
|
|
|
Console.WriteLine(buffer.ToString());
|
|
|
|
return ExitCode.Success;
|
|
}
|
|
}
|
|
} |