wp-cli / extension-command

Manages plugins and themes, including installs, activations, and updates.
MIT License
88 stars 80 forks source link

--format=json not available running plugin list #87

Closed gonzad26 closed 6 years ago

gonzad26 commented 6 years ago

I'm running the following command:

plugin list --fields=name,status,update,version,title,description,update_version --format=json Its output is empty.

If I use it with yaml or csv options, it works great.

danielbachhuber commented 6 years ago

Hi @gonzad26,

Could you share more details on how to reproduce? Our bug reporting guidelines are a good guide to the level of detail we're looking for.

gonzad26 commented 6 years ago

Yes of course. Sorry for the short message.

I'm currently running the following command: wp-cli.phar --path /home/wordpress/public_html/ plugin list --fields=name,status,update,version,title,description,update_version --format=json

and it's output is empty, but if run: wp-cli.phar --path /home/wordpress/public_html/ plugin list --fields=name,status,update,version,title,description,update_version --format=yaml

It's output is the following:


- name: twentyfifteen status: inactive update: available version: "1.8" title: Twenty Fifteen description: | Our 2015 default theme is clean, blog-focused, and designed for clarity. Twenty Fifteen's simple, straightforward typography is readable on a wide variety of screen sizes, and suitable for multiple languages. We designed it using a mobile-first approach, meaning your content takes center-stage, regardless of whether your visitors arrive by smartphone, tablet, laptop, or desktop computer. update_version: "1.9"

name: twentyseventeen status: active update: available version: "1.3" title: Twenty Seventeen description: | Twenty Seventeen brings your site to life with header video and immersive featured images. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device. update_version: "1.4"

name: twentysixteen status: inactive update: available version: "1.3" title: Twenty Sixteen description: | Twenty Sixteen is a modernized take on an ever-popular WordPress layout — the horizontal masthead with an optional right sidebar that works perfectly for blogs and websites. It has custom color options with beautiful default color schemes, a harmonious fluid grid using a mobile-first approach, and impeccable polish in every detail. Twenty Sixteen will make your WordPress look beautiful everywhere. update_version: "1.4"

danielbachhuber commented 6 years ago

Do you know why you get theme output when you run wp plugin list?

gonzad26 commented 6 years ago

Sorry, my bad. I was trying with themes too. With themes i dont have this problem with json output.

This is the output of plugin list in yaml


- name: akismet status: inactive update: available version: "4.0" title: Akismet Anti-Spam description: | Used by millions, Akismet is quite possibly the best way in the world to protect your blog from spam. It keeps your site protected even while you sleep. To get started: activate the Akismet plugin and then go to your Akismet Settings page to set up your API key. update_version: 4.0.3

name: hello status: inactive update: none version: "1.6" title: Hello Dolly description: | This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from Hello, Dolly in the upper right of your admin screen on every page. update_version: null

status: active update: none version: "1.2" title: WP CLI Login Command Server description: Companion plugin to the WP-CLI Login Command update_version: null

danielbachhuber commented 6 years ago

@gonzad26 It looks like your YAML data is broken too:

image

It's hard to say what the problem might be without being able to reproduce, but it seems like it's tied to a specific plugin. If this is a production environment, I'd suggest creating a second environment for testing, and installing each plugin separately to see if it might be caused by one.

gonzad26 commented 6 years ago

Right! I've tried with a fresh install and it worked good. The plugin that break the json output is WP CLI Login Command Server

Anyway, using yaml output format, i dont have any problem with the sintax of the output to parse it.

danielbachhuber commented 6 years ago

I tried installing WP-CLI Login Command Server:

wp plugin install https://github.com/aaemnnosttv/wp-cli-login-server/archive/master.zip
Downloading installation package from https://github.com/aaemnnosttv/wp-cli-login-server/archive/master.zip...
Unpacking the package...
Installing the plugin...
Renamed Github-based project from 'wp-cli-login-server-master' to 'wp-cli-login-server'.
Plugin installed successfully.
Success: Installed 1 of 1 plugins

I'm unable to reproduce the broken JSON issue:

wp plugin list --format=json --fields=name,status,update,version,title,description,update_version
[{"name":"application-passwords","status":"inactive","update":"none","version":"0.1-dev","title":"Application Passwords","description":"A prototype framework to add application passwords to core.","update_version":null},{"name":"gutenberg","status":"active","update":"available","version":"2.1.0","title":"Gutenberg","description":"Printing since 1440. This is the development plugin for the new block\neditor in core.","update_version":"2.3.0"},{"name":"hello","status":"inactive","update":"none","version":"1.6","title":"Hello Dolly","description":"This is not just a plugin, it symbolizes the hope and enthusiasm of an\nentire generation summed up in two words sung most famously by Louis\nArmstrong: Hello, Dolly. When activated you will randomly see a lyric from\n<cite>Hello, Dolly<\/cite> in the upper right of your admin screen on every\npage.","update_version":null},{"name":"post-content-link-filter","status":"inactive","update":"none","version":"0.1.0-alpha","title":"Post Content Link Filter","description":"Process content for its links and allow transformation with a filter.","update_version":null},{"name":"sample-plugin","status":"inactive","update":"none","version":"0.1.0","title":"Sample Plugin","description":"PLUGIN DESCRIPTION HERE","update_version":null},{"name":"sensei","status":"inactive","update":"none","version":"1.9.19","title":"Sensei","description":"A course management plugin that offers the smoothest platform for helping\nyou teach anything.","update_version":null},{"name":"user-switching","status":"inactive","update":"available","version":"1.0.8","title":"User Switching","description":"Instant switching between user accounts in WordPress","update_version":"1.3.0"},{"name":"wp-cli-login-server","status":"inactive","update":"none","version":"1.2","title":"WP CLI Login Command Server","description":"Companion plugin to the WP-CLI Login Command","update_version":null},{"name":"wp-saml-auth","status":"inactive","update":"available","version":"0.3.3","title":"WP SAML Auth","description":"SAML authentication for WordPress, using SimpleSAMLphp.","update_version":"0.3.8"},{"name":"local","status":"must-use","update":"none","version":"","title":"","description":"","update_version":null}]

Are there other relevant details you can share to reproduce?

schlessera commented 6 years ago

I cannot reproduce this either. @gonzad26 You'll have to pinpoint this further (or try reinstalling WP-CLI & packages).