@@ -936,8 +936,11 @@ public function is_active( $args, $assoc_args = array() ) {
936
936
*
937
937
* ## OPTIONS
938
938
*
939
- * <plugin>...
939
+ * [ <plugin>...]
940
940
* : One or more plugins to delete.
941
+ *
942
+ * [--all]
943
+ * : If set, all plugins will be deleted.
941
944
*
942
945
* ## EXAMPLES
943
946
*
@@ -952,7 +955,15 @@ public function is_active( $args, $assoc_args = array() ) {
952
955
* Success: Deleted 1 of 1 plugins.
953
956
*/
954
957
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
+
955
965
$ successes = $ errors = 0 ;
966
+
956
967
foreach ( $ this ->fetcher ->get_many ( $ args ) as $ plugin ) {
957
968
if ( $ this ->_delete ( $ plugin ) ) {
958
969
WP_CLI ::log ( "Deleted ' {$ plugin ->name }' plugin. " );
@@ -1076,15 +1087,15 @@ protected function get_status( $file ) {
1076
1087
1077
1088
/**
1078
1089
* Gets the template path based on installation type.
1079
- */
1090
+ */
1080
1091
private static function get_template_path ( $ template ) {
1081
1092
$ command_root = Utils \phar_safe_path ( dirname ( __DIR__ ) );
1082
1093
$ template_path = "{$ command_root }/templates/ {$ template }" ;
1083
-
1094
+
1084
1095
if ( ! file_exists ( $ template_path ) ) {
1085
1096
WP_CLI ::error ( "Couldn't find {$ template }" );
1086
1097
}
1087
-
1098
+
1088
1099
return $ template_path ;
1089
1100
}
1090
1101
0 commit comments