Shared-Counts icon indicating copy to clipboard operation
Shared-Counts copied to clipboard

Add WP-CLI commands - shared-counts display, shared-counts popular, shared-counts update

Open richardbuff opened this issue 5 years ago • 1 comments

Add WP-CLI functionality

wp shared-counts display 123 Display shares for single post

wp shared-counts popular --count=100 Display most popular posts

wp shared-counts update 123 Update share counts for a single post

Screencast of these three commands in action:

https://share.getcloudapp.com/z8ux9L4D

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] Enhancement (modification of the currently available functionality)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project (WordPress coding standards, etc).
  • [x] My code has appropriate phpdoc comments with a description, @since, @params and @return.
  • [ ] My code is tested for both new installs and for users that are upgrading from older versions.

richardbuff avatar May 18 '20 18:05 richardbuff

Looks great to me! Here are some recommended changes:

  • Change wp shared-counts display to wp shared-counts get
  • In the popular subcommand, set the default posts_per_page to 20, matching the dashboard widget
  • In the popular subcommand, make the first column Post ID and the second column Title
  • Consider using the table output style for the get and update subcommands, matching the popular one.

billerickson avatar Jun 08 '20 14:06 billerickson