Skip to content

Create wp config get to list configurations of wp-config.php#9

Merged
danielbachhuber merged 4 commits intowp-cli:masterfrom
rahul3883:issue/GH-2
May 4, 2017
Merged

Create wp config get to list configurations of wp-config.php#9
danielbachhuber merged 4 commits intowp-cli:masterfrom
rahul3883:issue/GH-2

Conversation

@rahul3883
Copy link
Copy Markdown
Contributor

@rahul3883 rahul3883 commented May 3, 2017

We can also format the result using --format option.
eg. wp config get --format=csv

Fixes #2

Copy link
Copy Markdown
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! 👍

One comment to address, and you'll need to add a functional test too.

$formatter->display_items( $wp_config_vars );

WP_CLI::line( preg_replace( '/^([A-Z ]+)/m', WP_CLI::colorize( '%9\1%n' ), "\nCONSTANTS\n" ) );
$formatter->display_items( $wp_config_constants );
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consolidate this to just one table, and introduce a third type column that denotes whether it's a variable or constant

If it's just one call to display_items(), the --format=json, etc. will produce machine-parsable output. If you call display_items() more than once, the rendered JSON isn't easily digestible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's consolidate this to just one table, and introduce a third type column that denotes whether it's a variable or constant

Sounds good. Done.

If it's just one call to display_items(), the --format=json, etc. will produce machine-parsable output. If you call display_items() more than once, the rendered JSON isn't easily digestible.

👍

@rahul3883
Copy link
Copy Markdown
Contributor Author

you'll need to add a functional test too.

I believe a functional test should be the last part. So I was waiting for your reply about any changes if needed 😅

@danielbachhuber danielbachhuber added this to the 1.1.0 milestone May 4, 2017
@danielbachhuber danielbachhuber added command:config Related to 'config' command command:config-get Related to 'config get' command labels May 4, 2017
@danielbachhuber
Copy link
Copy Markdown
Member

Looks great! Thanks for your work :)

@danielbachhuber danielbachhuber merged commit cf7da88 into wp-cli:master May 4, 2017
@rahul3883 rahul3883 deleted the issue/GH-2 branch May 4, 2017 19:30
schlessera pushed a commit that referenced this pull request Jan 6, 2022
Create `wp config get` to list configurations of `wp-config.php`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:config Related to 'config' command command:config-get Related to 'config get' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants