wp-cli / scaffold-package-command

Scaffolds WP-CLI commands with functional tests, full README.md, and more.
MIT License
68 stars 19 forks source link

Introduce Featured Commands in README in scaffold package-readme #227

Closed ernilambar closed 5 months ago

ernilambar commented 5 months ago

Feature Request

Describe your use case and the problem you are facing

For package with large number of commands and subcommands, navigating through commands is quite difficult. TOC in the beginning of readme would be very helpful.

Describe the solution you'd like

List the commands anchored with corresponding command.

Example: https://github.com/ernilambar/entity-command/blob/toc/README.md

danielbachhuber commented 5 months ago

Thanks for the suggestion!

I think listing all of the commands in a TOC could be a bit much for some. However, we could allow package authors curate the most popular commands into TOC (and indicate as such).

ernilambar commented 5 months ago

In extra in composer.json, lets support featured-commands parameter:

    "featured-commands": [
      "database test",
      "database reset"
    ],

Output would be:

Screenshot 2024-02-26 at 12 12 46 PM

Example: https://github.com/ernilambar/database-command/tree/yo-toc#readme

danielbachhuber commented 5 months ago

Cool, I think that looks reasonably good.

swissspidy commented 5 months ago

FWIW, GitHub already shows a table of contents:

Screenshot 2024-02-28 at 10 37 15

IIRC we already had this discussion at some point.

ernilambar commented 5 months ago

Yah it seems there is already an issue: https://github.com/wp-cli/scaffold-package-command/issues/141

ernilambar commented 5 months ago

@swissspidy That GitHub thingy of readme file looks cool. I didn't know that. Nice. This issue was started with full TOC is mind but now discussion is going around featured commands

ernilambar commented 5 months ago

@danielbachhuber Featured commands was sparked from the need to see all commands in a bird eye view, which GitHub kind of already provides (even though with one extra click). So I am now neutral about this now. I am ok whatever you decide.

danielbachhuber commented 5 months ago

Yeah, let's wontfix this. I think it's only a problem when a package has a lot of commands, which is just a few.

Package authors can easily highlight featured commands by creating a custom section part