WP_CLI
Completions::get_global_parameters
Get global parameters.
Method of the class: Completions{}
No Hooks.
Returns
Array. Associative array of global parameters.
Usage
// private - for code of main (parent) class only $result = $this->get_global_parameters();
Completions::get_global_parameters() Completions::get global parameters code WP-CLI 2.13.0-alpha
private function get_global_parameters() {
$params = [];
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;
}
$params[ $key ] = $details['runtime'];
// Add additional option like `--[no-]color`.
if ( true === $details['runtime'] ) {
$params[ 'no-' . $key ] = '';
}
}
return $params;
}