Closed riccardodicurti closed 8 months ago
Thanks for the report, @riccardodicurti
I believe wp core check-update --format=json
returns an empty result because there are no updates available.
What is your expected behavior?
Ciao @danielbachhuber I would at least expect an empty json or a message telling me that no updates are available.
I would at least expect an empty json or a message telling me that no updates are available.
I'm not sure a message would make sense. If you're passing the data into JSON parser, a string would break the parser.
wp post list --format=json
produces an empty array:
$ wp post list --format=json
[]
Would an empty array work for your purposes?
Also, for posterity, could you share a bit more detail about your use case?
Yes, my suggestion was definitely to return the message via json. In any case, the empty array is still sufficient to verify that we have received the response.
I am currently writing a set of tests and update routines via ssh using the cli.
Ok, makes sense. I think I'd be fine to change wp core check-update --format=json
to return an empty array, and consider this a bug in the original implementation.
Summary: From the information contained in the WordPress Developer Resources I read that it can set the return format https://developer.wordpress.org/cli/commands/core/update/ but give a return only for table format.
Steps to reproduce: Run command ‘wp core check-update --format=json’
` /**
OPTIONS
EXAMPLES
@subcommand check-update */ public function checkupdate( $, $assoc_args ) {
} `