WP_CLI\Dispatcher
CompositeCommand::get_global_params
Get the list of global parameters
Метод класса: CompositeCommand{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_global_params( $root_command );
- $root_command(строка)
- whether to include or not root command specific description.
По умолчанию:false
Код CompositeCommand::get_global_params() CompositeCommand::get global params WP-CLI 2.13.0-alpha
protected function get_global_params( $root_command = false ) {
$binding = [];
$binding['root_command'] = $root_command;
if ( ! $this->can_have_subcommands() || ( is_object( $this->parent ) && get_class( $this->parent ) === 'WP_CLI\Dispatcher\CompositeCommand' ) ) {
$binding['is_subcommand'] = true;
}
foreach ( WP_CLI::get_configurator()->get_spec() as $key => $details ) {
if ( false === $details['runtime'] ) {
continue;
}
if ( isset( $details['deprecated'] ) ) {
continue;
}
if ( isset( $details['hidden'] ) ) {
continue;
}
if ( true === $details['runtime'] ) {
$synopsis = "--[no-]$key";
} else {
$synopsis = "--$key" . $details['runtime'];
}
// Check if global parameters synopsis should be displayed or not.
if ( 'true' !== getenv( 'WP_CLI_SUPPRESS_GLOBAL_PARAMS' ) ) {
$binding['parameters'][] = [
'synopsis' => $synopsis,
'desc' => $details['desc'],
];
$binding['has_parameters'] = true;
}
}
if ( $this->get_subcommands() ) {
$binding['has_subcommands'] = true;
}
return Utils\mustache_render( 'man-params.mustache', $binding );
}