Skip to content

--help and --version moved to the top of the Options section #2589

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

Now that the --help and --version options are added by the RootCommand constructor in 2.0.0-beta5.25306.1, rather than by CommandLineBuilderExtensions, they tend to stay at the beginning of the Command.Options list when the application adds its own options. The --help output then lists them at the top of the Options section, rather than at the bottom which would be more traditional.

I suppose an application could fix that by using IList<T>.Insert to add its options in front of those two, or more easily by clearing the whole list, adding its options, and then adding new instances of HelpOption and VersionOption. The latter solution would also let the application easily set a custom action for the HelpOption, as requested in #2588

It would be nicer if those options were placed at the bottom of the table by default, without the application needing to move them explicitly. But I'm not sure how to implement that now without breaking compatibility or extensibility.

I considered posting this as a comment in #2576 but filed as a separate issue because there might be some kind of fix.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions