Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search: Add plugin or theme's URL on wordpress.org #108

Merged
merged 3 commits into from Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Plugin_Command.php
Expand Up @@ -152,6 +152,7 @@ public function status( $args ) {
* **icons**: Plugin's Icon Image Link
* **active_installs**: Plugin's Number of Active Installs
* **contributors**: Plugin's List of Contributors
* **url**: Plugin's URL on wordpress.org
*
* [--format=<format>]
* : Render output in a particular format.
Expand Down
1 change: 1 addition & 0 deletions src/Theme_Command.php
Expand Up @@ -125,6 +125,7 @@ public function status( $args ) {
* **num_ratings**: Number of Theme Ratings
* **homepage**: Theme Author's Homepage
* **description**: Theme Description
* **url**: Theme's URL on wordpress.org
*
* [--format=<format>]
* : Render output in a particular format.
Expand Down
5 changes: 5 additions & 0 deletions src/WP_CLI/CommandWithUpgrade.php
Expand Up @@ -613,6 +613,11 @@ protected function _search( $args, $assoc_args ) {

$items = $api->$plural;

// Add `url` for plugin or theme on wordpress.org.
foreach ( $items as $index => $item_object ) {
$item_object->url = "https://wordpress.org/{$plural}/{$item_object->slug}/";
}

if ( 'table' === $format ) {
$count = \WP_CLI\Utils\get_flag_value( $api->info, 'results', 'unknown' );
\WP_CLI::success( sprintf( 'Showing %s of %s %s.', count( $items ), $count, $plural ) );
Expand Down