Skip to content

--version does not work when you configure an argument on the root command #2591

Open
@blowdart

Description

@blowdart

I have a configuration like the following

var statusArgument = new Argument<string>("status")
{
    Description = "What you are doing right now?"
};

var allowRepliesOption = new Option<bool>("--allowReplies", "-r", "/r")
{
    Description = "Allow replies to your status update.",
    DefaultValueFactory = defaultValue => true
};

var rootCommand = new RootCommand("Post a quick status update on Bluesky")
{
    statusArgument,
    allowRepliesOption
};

etc.

-h works, but --version takes the argument into account, so I get

Required argument missing for command: 'bloop'.

Edited:

More detailed repro steps below at #2591 (comment).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions