Skip to content

HelpVerbOptionAttribute broken #138

Closed
@CrescentFresh

Description

@CrescentFresh

Piecing together [HelpVerbOption] usage, the below example from the wiki doesn't render anything.

CommandLine 1.9.71 via nuget.

Repro:

class Options
{
    public Options()
    {
        // Since we create this instance the parser will not overwrite it
        CommitVerb = new CommitSubOptions();
    }

    [CommandLine.VerbOption("commit", HelpText = "Record changes to the repository.")]
    public CommitSubOptions CommitVerb { get; set; }

    [CommandLine.HelpVerbOption]
    public string GetUsage(string verb)
    {
        return "this never appears";
    }
}

class CommitSubOptions
{
    [CommandLine.Option('a', "all", HelpText = "Tell the command to automatically stage files.")]
    public bool All { get; set; }
    // Remainder omitted
}

internal class Program
{
    private static void Main(string[] args)
    {
        var options = new Options();
        args = "help commit".Split();
        CommandLine.Parser.Default.ParseArguments(args, options);
        Console.ReadLine();
    }
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions