@@ -936,8 +936,11 @@ public function is_active( $args, $assoc_args = array() ) {
936936 *
937937 * ## OPTIONS
938938 *
939- * <plugin>...
939+ * [ <plugin>...]
940940 * : One or more plugins to delete.
941+ *
942+ * [--all]
943+ * : If set, all plugins will be deleted.
941944 *
942945 * ## EXAMPLES
943946 *
@@ -952,7 +955,15 @@ public function is_active( $args, $assoc_args = array() ) {
952955 * Success: Deleted 1 of 1 plugins.
953956 */
954957 public function delete ( $ args , $ assoc_args = array () ) {
958+ $ all = Utils \get_flag_value ( $ assoc_args , 'all ' , false );
959+
960+ // Check if plugin names of --all is passed.
961+ if ( ! ( $ args = $ this ->check_optional_args_and_all ( $ args , $ all , 'delete ' ) ) ) {
962+ return ;
963+ }
964+
955965 $ successes = $ errors = 0 ;
966+
956967 foreach ( $ this ->fetcher ->get_many ( $ args ) as $ plugin ) {
957968 if ( $ this ->_delete ( $ plugin ) ) {
958969 WP_CLI ::log ( "Deleted ' {$ plugin ->name }' plugin. " );
@@ -1076,15 +1087,15 @@ protected function get_status( $file ) {
10761087
10771088 /**
10781089 * Gets the template path based on installation type.
1079- */
1090+ */
10801091 private static function get_template_path ( $ template ) {
10811092 $ command_root = Utils \phar_safe_path ( dirname ( __DIR__ ) );
10821093 $ template_path = "{$ command_root }/templates/ {$ template }" ;
1083-
1094+
10841095 if ( ! file_exists ( $ template_path ) ) {
10851096 WP_CLI ::error ( "Couldn't find {$ template }" );
10861097 }
1087-
1098+
10881099 return $ template_path ;
10891100 }
10901101
0 commit comments