cs-codex-dist-tests/Framework/ArgsUniform/ExampleUser.cs

35 lines
856 B
C#
Raw Normal View History

2023-06-26 11:58:41 +00:00
namespace ArgsUniform
{
public class ExampleUser
{
public class Args
{
[Uniform("aaa", "a", "AAA", false, "Sets the AAA!")]
public string Aaa { get; set; } = string.Empty;
[Uniform("bbb", "b", "BBB", true, "Sets that BBB")]
public string Bbb { get; set; } = string.Empty;
}
public class DefaultsProvider
{
public string Aaa { get { return "non-static operation"; } }
}
public void Example()
{
// env var: "AAA=BBB"
var args = "--ccc=ddd";
var uniform = new ArgsUniform<Args>(PrintHelp, new DefaultsProvider(), args);
2023-06-26 11:58:41 +00:00
var aaa = uniform.Parse();
}
private static void PrintHelp()
{
Console.WriteLine("Help text!");
}
2023-06-26 11:58:41 +00:00
}
}