@@ -597,7 +597,7 @@ public function get( $args, $assoc_args ) {
597597 *
598598 * [--all]
599599 * : If set, all themes that have updates will be updated.
600- *
600+ *
601601 * [--exclude=<theme-names>]
602602 * : Comma separated list of theme names that should be excluded from updating.
603603 *
@@ -639,7 +639,7 @@ public function get( $args, $assoc_args ) {
639639 * | twentysixteen | 1.1 | 1.2 | Updated |
640640 * +---------------+-------------+-------------+---------+
641641 * Success: Updated 2 of 2 themes.
642- *
642+ *
643643 * # Exclude themes updates when bulk updating the themes
644644 * $ wp theme update --all --exclude=twentyfifteen
645645 * Downloading update from https://downloads.wordpress.org/theme/astra.1.0.5.1.zip...
@@ -716,6 +716,35 @@ public function is_installed( $args, $assoc_args = array() ) {
716716 }
717717 }
718718
719+ /**
720+ * Checks if a given theme is active.
721+ *
722+ * Returns exit code 0 when active, 1 when not active.
723+ *
724+ * ## OPTIONS
725+ *
726+ * <theme>
727+ * : The plugin to check.
728+ *
729+ * ## EXAMPLES
730+ *
731+ * # Check whether theme is Active; exit status 0 if active, otherwise 1
732+ * $ wp theme is-active twentyfifteen
733+ * $ echo $?
734+ * 1
735+ *
736+ * @subcommand is-active
737+ */
738+ public function is_active ( $ args , $ assoc_args = array () ) {
739+ $ theme = wp_get_theme ( $ args [0 ] );
740+
741+ if ( ! $ theme ->exists () ) {
742+ WP_CLI ::halt ( 1 );
743+ }
744+
745+ $ this ->is_active_theme ( $ theme ) ? WP_CLI ::halt ( 0 ) : WP_CLI ::halt ( 1 );
746+ }
747+
719748 /**
720749 * Deletes one or more themes.
721750 *
0 commit comments