Skip to content

Commit faa452b

Browse files
authored
Merge pull request #108 from GaryJones/feature/94-url
Search: Add plugin or theme's URL on wordpress.org
2 parents c6556af + 9fd8da4 commit faa452b

File tree

4 files changed

+49
-0
lines changed

4 files changed

+49
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ search query.
451451
**icons**: Plugin's Icon Image Link
452452
**active_installs**: Plugin's Number of Active Installs
453453
**contributors**: Plugin's List of Contributors
454+
**url**: Plugin's URL on wordpress.org
454455

455456
[--format=<format>]
456457
Render output in a particular format.
@@ -1206,6 +1207,7 @@ search query.
12061207
**num_ratings**: Number of Theme Ratings
12071208
**homepage**: Theme Author's Homepage
12081209
**description**: Theme Description
1210+
**url**: Theme's URL on wordpress.org
12091211

12101212
[--format=<format>]
12111213
Render output in a particular format.
@@ -1341,6 +1343,44 @@ wp theme update [<theme>...] [--all] [--exclude=<theme-names>] [--format=<format
13411343
# Update all themes
13421344
$ wp theme update --all
13431345

1346+
1347+
1348+
### wp theme mod list
1349+
1350+
Gets a list of theme mods.
1351+
1352+
~~~
1353+
wp theme mod list [--field=<field>] [--format=<format>]
1354+
~~~
1355+
1356+
**OPTIONS**
1357+
1358+
[--field=<field>]
1359+
Returns the value of a single field.
1360+
1361+
[--format=<format>]
1362+
Render output in a particular format.
1363+
---
1364+
default: table
1365+
options:
1366+
- table
1367+
- json
1368+
- csv
1369+
- yaml
1370+
---
1371+
1372+
**EXAMPLES**
1373+
1374+
# Gets a list of theme mods.
1375+
$ wp theme mod list
1376+
+------------------+---------+
1377+
| key | value |
1378+
+------------------+---------+
1379+
| background_color | dd3333 |
1380+
| link_color | #dd9933 |
1381+
| main_text_color | #8224e3 |
1382+
+------------------+---------+
1383+
13441384
## Installing
13451385

13461386
This package is included with WP-CLI itself, no additional installation necessary.

src/Plugin_Command.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public function status( $args ) {
152152
* **icons**: Plugin's Icon Image Link
153153
* **active_installs**: Plugin's Number of Active Installs
154154
* **contributors**: Plugin's List of Contributors
155+
* **url**: Plugin's URL on wordpress.org
155156
*
156157
* [--format=<format>]
157158
* : Render output in a particular format.

src/Theme_Command.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ public function status( $args ) {
125125
* **num_ratings**: Number of Theme Ratings
126126
* **homepage**: Theme Author's Homepage
127127
* **description**: Theme Description
128+
* **url**: Theme's URL on wordpress.org
128129
*
129130
* [--format=<format>]
130131
* : Render output in a particular format.

src/WP_CLI/CommandWithUpgrade.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,13 @@ protected function _search( $args, $assoc_args ) {
613613

614614
$items = $api->$plural;
615615

616+
// Add `url` for plugin or theme on wordpress.org.
617+
foreach ( $items as $index => $item_object ) {
618+
if ( $item_object instanceof \stdClass ) {
619+
$item_object->url = "https://wordpress.org/{$plural}/{$item_object->slug}/";
620+
}
621+
}
622+
616623
if ( 'table' === $format ) {
617624
$count = \WP_CLI\Utils\get_flag_value( $api->info, 'results', 'unknown' );
618625
\WP_CLI::success( sprintf( 'Showing %s of %s %s.', count( $items ), $count, $plural ) );

0 commit comments

Comments
 (0)