Add support for converting command parameters into FileInfo and DirectoryInfo (#1145)

Add support for converting command parameters that doesn't have a built-in TypeConverter but has a constructor that takes a string. For CLI apps, FileInfo and DirectoryInfo will likely be the most useful ones, but there may be others.
This commit is contained in:
Cédric Luthi
2023-03-01 13:02:43 +01:00
committed by GitHub
parent 6740f0b02b
commit d3f4f5f208
6 changed files with 63 additions and 11 deletions

View File

@ -1,7 +1,15 @@
using System.IO;
namespace Spectre.Console.Tests.Data;
public class HorseSettings : MammalSettings
{
[CommandOption("-d|--day")]
public DayOfWeek Day { get; set; }
[CommandOption("--file")]
public FileInfo File { get; set; }
[CommandOption("--directory")]
public DirectoryInfo Directory { get; set; }
}