commandline icon indicating copy to clipboard operation
commandline copied to clipboard

Feature: ToString

Open Stretto opened this issue 7 years ago • 2 comments

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.

Stretto avatar Jun 17 '17 09:06 Stretto

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)

Stretto avatar Jun 17 '17 09:06 Stretto

parser.FormatCommandLine() does this no?

clmcgrath avatar Jun 26 '17 19:06 clmcgrath