Skip to content

Commit 1305b2b

Browse files
Add format option to wp plugin|theme auto-updates status (#351)
* Add format option to wp plugin|theme auto-updates status * Fix PHPCS issues --------- Co-authored-by: Daniel Bachhuber <daniel.bachhuber@automattic.com>
1 parent 1a1af1d commit 1305b2b

4 files changed

Lines changed: 60 additions & 0 deletions

File tree

features/plugin-auto-updates-status.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,21 @@ Feature: Show the status of auto-updates for WordPress plugins
9797
"""
9898
enabled
9999
"""
100+
101+
@require-wp-5.5
102+
Scenario: Formatting options work
103+
104+
When I run `wp plugin auto-updates status --all --format=json`
105+
Then STDOUT should be:
106+
"""
107+
[{"name":"akismet","status":"disabled"},{"name":"hello","status":"disabled"},{"name":"duplicate-post","status":"disabled"}]
108+
"""
109+
110+
When I run `wp plugin auto-updates status --all --format=csv`
111+
Then STDOUT should be:
112+
"""
113+
name,status
114+
akismet,disabled
115+
hello,disabled
116+
duplicate-post,disabled
117+
"""

features/theme-auto-update-status.feature

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,21 @@ Feature: Show the status of auto-updates for WordPress themes
100100
"""
101101
enabled
102102
"""
103+
104+
@require-wp-5.5
105+
Scenario: Formatting options work
106+
107+
When I run `wp theme auto-updates status --all --format=json`
108+
Then STDOUT should be:
109+
"""
110+
[{"name":"twentynineteen","status":"disabled"},{"name":"twentyseventeen","status":"disabled"},{"name":"twentysixteen","status":"disabled"}]
111+
"""
112+
113+
When I run `wp theme auto-updates status --all --format=csv`
114+
Then STDOUT should be:
115+
"""
116+
name,status
117+
twentynineteen,disabled
118+
twentyseventeen,disabled
119+
twentysixteen,disabled
120+
"""

src/Plugin_AutoUpdates_Command.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ public function disable( $args, $assoc_args ) {
231231
* [--field=<field>]
232232
* : Only show the provided field.
233233
*
234+
* [--format=<format>]
235+
* : Render output in a particular format.
236+
* ---
237+
* default: table
238+
* options:
239+
* - table
240+
* - csv
241+
* - json
242+
* - yaml
243+
* - count
244+
* ---
245+
*
234246
* ## EXAMPLES
235247
*
236248
* # Get the status of plugin auto-updates

src/Theme_AutoUpdates_Command.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ public function disable( $args, $assoc_args ) {
231231
* [--field=<field>]
232232
* : Only show the provided field.
233233
*
234+
* [--format=<format>]
235+
* : Render output in a particular format.
236+
* ---
237+
* default: table
238+
* options:
239+
* - table
240+
* - csv
241+
* - json
242+
* - yaml
243+
* - count
244+
* ---
245+
*
234246
* ## EXAMPLES
235247
*
236248
* # Get the status of theme auto-updates

0 commit comments

Comments
 (0)