diff --git a/README.md b/README.md index 224105c2..ead932b4 100644 --- a/README.md +++ b/README.md @@ -207,16 +207,23 @@ to communicate whether WordPress is installed. **EXAMPLES** - # Check whether WordPress is installed; exit status 0 if installed, otherwise 1 - $ wp core is-installed - $ echo $? - 1 + # Bash script for checking if WordPress is not installed - # Bash script for checking whether WordPress is installed or not - if ! wp core is-installed; then + if ! wp core is-installed 2>/dev/null; then + # WP is not installed. Let's try installing it. wp core install fi + # Bash script for checking if WordPress is installed, with fallback + + if wp core is-installed 2>/dev/null; then + # WP is installed. Let's do some things we should only do in a confirmed WP environment. + wp core verify-checksums + else + # Fallback if WP is not installed. + echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.' + fi + ### wp core multisite-convert diff --git a/src/Core_Command.php b/src/Core_Command.php index 045ca3b1..7f3a7560 100644 --- a/src/Core_Command.php +++ b/src/Core_Command.php @@ -348,15 +348,23 @@ function () use ( $temp ) { * * ## EXAMPLES * - * # Check whether WordPress is installed; exit status 0 if installed, otherwise 1 - * $ wp core is-installed - * $ echo $? - * 1 + * # Bash script for checking if WordPress is not installed * - * # Bash script for checking whether WordPress is installed or not - * if ! wp core is-installed; then + * if ! wp core is-installed 2>/dev/null; then + * # WP is not installed. Let's try installing it. * wp core install * fi + * + * # Bash script for checking if WordPress is installed, with fallback + * + * if wp core is-installed 2>/dev/null; then + * # WP is installed. Let's do some things we should only do in a confirmed WP environment. + * wp core verify-checksums + * else + * # Fallback if WP is not installed. + * echo 'Hey Friend, you are in the wrong spot. Move in to your WordPress directory and try again.' + * fi + * * @subcommand is-installed */