Conversation
|
Fixes #41 |
README.md
Outdated
| ### wp config get | ||
|
|
||
| Gets variables, constants, and file includes defined in wp-config.php file. | ||
| Get the value of a specific variable or constant defined in wp-config.php |
There was a problem hiding this comment.
Just first glance notice lack of third-person singular here and in list!
src/Config_Command.php
Outdated
| */ | ||
| public function get( $_, $assoc_args ) { | ||
| public function list_( $args, $assoc_args ) { | ||
| $path = Utils\locate_wp_config(); |
There was a problem hiding this comment.
Another trivial one, there's a space at the beginning of the line here before the tab, and in 4 other places /^ \t/
There was a problem hiding this comment.
Fixed. Copy/paste issue because I copied from a previous implementation I had already previously done.
src/Config_Command.php
Outdated
| public function list_( $args, $assoc_args ) { | ||
| $path = Utils\locate_wp_config(); | ||
| if ( ! $path ) { | ||
| WP_CLI::error( "'wp-config.php' not found." ); |
There was a problem hiding this comment.
Maybe here and for get, add a similar spiel as in Runner::check_wp_version() about Pass --path=path/to/wordpress
|
|
||
| $strict = Utils\get_flag_value( $assoc_args, 'strict' ); | ||
| if ( $strict && empty( $args ) ) { | ||
| WP_CLI::error( 'The --strict option can only be used in combination with a filter.' ); |
There was a problem hiding this comment.
Could you add a test to config-list.feature to invoke this error?
| continue; | ||
| } | ||
|
|
||
| if ( false === strpos( $value['key'], $filter ) ) { |
There was a problem hiding this comment.
I see you have tests for case but was wondering should this case-insensitive as not strict? (Or maybe add a case-insensitive flag).
There was a problem hiding this comment.
Case-insensitivity will probably open up a huge can of worms. I'd prefer to keep everything case-sensitive for now.
Restructure config value retrieval
wp config listnow produces a list of all config variables, constants and included files.wp config get <key>now retrieves the value of the requested config key.Note: Default behavior is to retrieve whatever key happens to fit, across both constants and variables. In case there's an ambiguous key that happens to exist as both a variable and a constant (which should be pretty rare), it will throw an error and ask for an explicit
--type=<type>to disambiguate.