OSDN Git Service

make merge_config() work for runtime args too
authorscribu <mail@scribu.net>
Sat, 23 Nov 2013 09:39:26 +0000 (11:39 +0200)
committerscribu <mail@scribu.net>
Sat, 23 Nov 2013 09:39:26 +0000 (11:39 +0200)
php/WP_CLI/Configurator.php
php/WP_CLI/Runner.php

index 791c6c5..2bfeacf 100644 (file)
@@ -84,9 +84,9 @@ class Configurator {
                return array( $regular_args, $assoc_args, $runtime_config );
        }
 
-       function merge_config( $config ) {
+       function merge_config( $config, $type ) {
                foreach ( $this->spec as $key => $details ) {
-                       if ( $details['file'] && isset( $config[ $key ] ) ) {
+                       if ( false !== $details[ $type ] && isset( $config[ $key ] ) ) {
                                $value = $config[ $key ];
 
                                if ( $details['multiple'] ) {
index a107a28..707b371 100644 (file)
@@ -368,15 +368,11 @@ class Runner {
 
                $configurator = \WP_CLI::get_configurator();
                foreach ( array( $this->global_config_path, $this->project_config_path ) as $config_path ) {
-                       $configurator->merge_config( self::load_config( $config_path ) );
+                       $configurator->merge_config( self::load_config( $config_path ), 'file' );
                }
-               $configurator->merge_config( $runtime_config );
+               $configurator->merge_config( $runtime_config, 'runtime' );
                $this->config = $configurator->to_array();
 
-               // --prompt can't be set in file, but is still a valid runtime arg
-               if ( ! empty( $runtime_config['prompt'] ) )
-                       $this->config['prompt'] = true;
-
                if ( !isset( $this->config['path'] ) ) {
                        $this->config['path'] = dirname( Utils\find_file_upward( 'wp-load.php' ) );
                }