command line argument default value does not show up in help

Jan 31, 2013 at 8:47 AM
Am I missing some configuration switch, or the specified command line argument default value does not show up in the help?

I have this in my application:
[Option("i", "ip", Required = false, HelpText = "DB host IP address.", DefaultValue = "192.168.0.10")]
public string Ip { get; set; }
When I execute this from the command line:
MPUTools.exe --help
This code exectues:
        [HelpOption]
        public string GetUsage()
        {
            var help = new HelpText
            {
                Heading = new HeadingInfo("MPUTools", "v1.6"),
                //Copyright = new CopyrightInfo("<>", 2012),
                AdditionalNewLineAfterOption = true,
                AddDashesToOption = true
            };
            //help.AddPreOptionsLine("<>");
            help.AddPreOptionsLine(String.Format("Usage: {0}.exe [ func ]", System.Diagnostics.Process.GetCurrentProcess().ProcessName));
            help.AddOptions(this);
            return help;
        }
And I get help for the argument, but no default value indicated:
> MPUTools.exe --help
MPUTools - TANGO_BUS MPU querying aid v1.6
Usage: MPUTools.exe [ func ]

 -i, --ip                     DB host IP address.
could you please tell me how to make default value to show up in the help, something along these lines:
 -i, --ip                     DB host IP address (default: 192.168.0.10).
Coordinator
Feb 24, 2013 at 4:35 AM
Download from here or with NuGet (or clone source and compile) a newest version.

Define the option with a System.Char as short name:
[Option('i', "ip", Required = false, HelpText = "DB host IP address.", DefaultValue = "192.168.0.10")]
public string Ip { get; set; }
Use AutoBuild properly (with IParserState):
class Options {

  // Your options here

  [ParserState]
  IParserState LastParserState { get; set; } // the name don't care but I suggest this

  [HelpOption]
  public string GetUsage() {
    return HelpText.AutoBuild(this,
      (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
  }
}
Did this helped?
Coordinator
Feb 24, 2013 at 4:44 AM
I want to add that wiki now talks about only latest versions, eliminating confusion:

https://github.com/gsscoder/commandline/wiki/Display-A-Help-Screen

Give a read to this, may help. :D