Skip to content

Conversation

@BrianHenryIE
Copy link
Member

@BrianHenryIE BrianHenryIE commented Jul 3, 2024

I want to use the same documentation style in my own plugins. I.e. wp handbook gen-custom my-command should generate markdown docs for my command, wherever I want them in my project.

NAME

  wp handbook gen-custom

DESCRIPTION

  Generate the documentation page for a custom command using the same templates as the official WP-CLI commands.

SYNOPSIS

  wp handbook gen-custom <command> [--output_dir=<output_dir>] [--verbose]

OPTIONS

  <command>
    The custom WP CLI command to generate the documentation for.

  [--output_dir=<output_dir>]
    Directory in which to save the documentation.
    ---
    default: ./docs/wp-cli
    ---

  [--verbose]
    If set will list command pages as they are generated.
  • ./docs/ was chosen based on php-pds/skeleton
  • gen-custom should maybe be gen-custom-command
  • Documentation above needs examples – what WordPress maintained plugin has CLI commands?
  • I need to consider how to handle subcommands
  • Documentation for gen-all (which runs on @when before_wp_load) needs to make clear that it means all WP CLI native commands
  • Tests

@ernilambar
Copy link
Member

I think this would be a good candidate for separate WP-CLI package. Few months back, I needed similar for the commands in a plugin. I ended up copying and modifying the parser from this repo and used it to generate docs.

@ayousefnezhad1-eng
Copy link

Code Quality Checks

@swissspidy
Copy link
Member

Perhaps this is something for scaffold-package-command? It already generates Markdown content for the readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants