Help_Command::get_initial_markdownprivate staticWP-CLI 1.0

Method of the class: Help_Command{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = Help_Command::get_initial_markdown( $command );
$command(required)
.

Help_Command::get_initial_markdown() code WP-CLI 2.13.0-alpha

private static function get_initial_markdown( $command ) {
	$name = implode( ' ', Dispatcher\get_path( $command ) );

	$binding = [
		'name'      => $name,
		'shortdesc' => $command->get_shortdesc(),
	];

	$binding['synopsis'] = "$name " . $command->get_synopsis();

	$alias = $command->get_alias();
	if ( $alias ) {
		$binding['alias'] = $alias;
	}
	$hook_name        = $command->get_hook();
	$hook_description = $hook_name ? Utils\get_hook_description( $hook_name ) : null;
	if ( $hook_description && 'after_wp_load' !== $hook_name ) {
		if ( $command->can_have_subcommands() ) {
			$binding['shortdesc'] .= "\n\nUnless overridden, these commands run on the '$hook_name' hook, $hook_description";
		} else {
			$binding['shortdesc'] .= "\n\nThis command runs on the '$hook_name' hook, $hook_description";
		}
	}

	if ( $command->can_have_subcommands() ) {
		$binding['has-subcommands']['subcommands'] = self::render_subcommands( $command );
	}

	return Utils\mustache_render( 'man.mustache', $binding );
}