Skip to content

--help no longer displays the option argument if Option.HelpName is not set #2128

Open
@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

In System.CommandLine 2.0.0-beta4.22272.1 (commit 209b724), if I set up an option like this

            this.jsonDirectoryOption = new Option<DirectoryInfo>(
                name: "--json-directory",
                description: "Writes API JSON responses to the specified directory.");
            this.jsonDirectoryOption.ExistingOnly();
            this.Add(this.jsonDirectoryOption);

then --help generated a default description for the argument of the option:

  --json-directory <json-directory>   Writes API JSON responses to the specified directory.

In System.CommandLine 2.0.0-beta4.23165.2 (commit 4d1e6ac), if I similarly set up an option

            this.jsonDirectoryOption = new Option<DirectoryInfo>("--json-directory")
            {
                Description = "Writes API JSON responses to the specified directory.",
            };
            this.jsonDirectoryOption.AcceptExistingOnly();
            this.Options.Add(this.jsonDirectoryOption);

then --help does not show that the option requires an argument:

  --json-directory                    Writes API JSON responses to the specified directory.

I can correct the --help output by setting Option.HelpName in my application, but this is quite a surprising change and should at least be documented in the upcoming release notes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions