Skip to content

Improve the visualisation of commands in the default group #125

Closed
@acataluddi

Description

@acataluddi

Hi Jitendra,

Thank you for creating this nice library. I would like to contribute a minor improvement for the visualisation of commands in the default group. In fact, when the help is generated, these commands are listed under a * symbol.

Toolname, version 0.2.0-dev

Commands:
*
  build    Sample build command
  export   Sample export command

Run `<command> --help` for specific help

Naturally, this is quite subjective, but I spent some time trying to figure out what I had done wrong, which I believed caused the glitch of having a spurious * symbol rendered. Perhaps it was intentional; however, I personally found it counter-intuitive.

I am submitting a patch that:

  • Removes the * symbol for the default group.
  • Ensures that commands in the default group are always listed at the very top.
  • Lists these commands without a group label.

The output is as follows:

Toolname, version 0.2.0-dev

Commands:
  build    Sample build command
  export   Sample export command
group
  sub1     Subcommand for testing 1
  sub2     Subcommand for testing 2

Run `<command> --help` for specific help

Personally, I find this approach more intuitive and aligned with what one might naturally expect. Additionally, it still provides the flexibility to implement other preferred behaviours (e.g. placing the default commands in a group named default or even * using inGroup()).

By the way, I have also updated the unit tests accordingly.

Note:

  • I took the opportunity to place the PhpUnit cache file within a transient tests subfolder folder to avoid polluting the root directory.
  • I added a few missing comments and types in the OutputHelper class that I modified, as well as grouped the public and protected methods.

Kind regards,
Adriano

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions