Skip to content

Usage help has wrong order of options and commands #303

Description

@AndreGleichner

Describe the bug
Generated usage help is e.g.
Usage: mytool [options] [command]
instead of:
Usage: mytool [command] [options]

To Reproduce
Steps to reproduce the behavior:

  1. Using this version of the library '2.4.2'
  2. Run code below
  3. With these arguments '-h'
  4. See wrong output "Usage: mytool [options] [command]"

Expected behavior
It should show "Usage: mytool [command] [options]"
Since having any options in front of the command verb fails.

Additional context
Repro code:

    [Command("mytool")]
    [Subcommand(typeof(MysubCommand))]
    class Program
    {
        static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
    }
    [Command]
    class MysubCommand { }

As a workaround I currently have a specialized DefaultHelpTextGenerator with overridden GenerateUsage().

Metadata

Metadata

Labels

buggood first issueThis seems like a good issue if you're a new contributor.help wantedWe would be willing to take a well-written PR to help fix this.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions