wp-cli/wp-cli — pull request #347 by leewillis77 (2013-03-08 14:13:06+00:00)
Title: Avoid warning if no rewrite rules exist

Currently running "wp rewrite dump" against a site that has never had permalinks set throws a warning since the return value from the get_option call is false, but is assumed to be an array, and is not checked before used in a foreach()

The attached PR amends the code to avoid the warning. It also goes a bit further and produces some default output "No rules" in the case where there are no rules configured, both in the JSON, and non-JSON case.

If you'd prefer it to output nothing happy to rework the PR...