wp-cli / handbook

📖 Complete documentation for WP-CLI
https://make.wordpress.org/cli/handbook/
MIT License
186 stars 320 forks source link

Add `wp handbook gen-custom` for custom commands #526

Open BrianHenryIE opened 2 weeks ago

BrianHenryIE commented 2 weeks ago

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.
ernilambar commented 2 weeks ago

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.