commandline
commandline copied to clipboard
Feature: ToString
override ToString for options to have it display all the options and their values. this is for debugging purposes. Similar to the --help but instead of help text, shows values.
something like
public void PrintOptionValues()
{
var props = this.GetType().GetProperties();
foreach(var p in props)
{
var att = p.GetCustomAttribute<OptionAttribute>();
if (att == null) continue;
Console.WriteLine("\t--" + att.LongName + " = " + p.GetValue(this));
}
Console.WriteLine();
}
(I tried to override ToString but options were being printed multiple times)
parser.FormatCommandLine() does this no?