CLI_Command::param_dump()publicWP-CLI 1.0

Dumps the list of global parameters, as JSON or in var_export format.

OPTIONS

[--with-values]
Display current values also.
[--format=<format>]
Render output in a particular format.
--- default: json options:
  • var_export
  • json

EXAMPLES

# Dump the list of global parameters.
$ wp cli param-dump --format=var_export
array (
  'path' =>
  array (
	'runtime' => '=<path>',
	'file' => '<path>',
	'synopsis' => '',
	'default' => NULL,
	'multiple' => false,
	'desc' => 'Path to the WordPress files.',
  ),
  'url' =>
  array (

Метод класса: CLI_Command{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$CLI_Command = new CLI_Command();
$CLI_Command->param_dump( $_, $assoc_args );
$_ (обязательный)
-
$assoc_args (обязательный)
-

Код CLI_Command::param_dump() WP-CLI 2.8.0-alpha

public function param_dump( $_, $assoc_args ) {
	$spec = WP_CLI::get_configurator()->get_spec();

	if ( Utils\get_flag_value( $assoc_args, 'with-values' ) ) {
		$config = WP_CLI::get_configurator()->to_array();
		// Copy current config values to $spec.
		foreach ( $spec as $key => $value ) {
			$current = null;
			if ( isset( $config[0][ $key ] ) ) {
				$current = $config[0][ $key ];
			}
			$spec[ $key ]['current'] = $current;
		}
	}

	if ( 'var_export' === Utils\get_flag_value( $assoc_args, 'format' ) ) {
		var_export( $spec );
	} else {
		echo json_encode( $spec );
	}
}