@@ -17,6 +17,8 @@ final class Release_Command {
1717 * [--bundle]
1818 * : Close the milestones for the entire bundle.
1919 *
20+ * [--all]
21+ * : Close the milestones for all repositories in the wp-cli organization.
2022 *
2123 * @subcommand close-released
2224 * @when before_wp_load
@@ -25,7 +27,9 @@ public function close_released( $args, $assoc_args ) {
2527
2628 $ repos = (array ) $ args ;
2729
28- if ( Utils \get_flag_value ( $ assoc_args , 'bundle ' , false ) ) {
30+ if ( Utils \get_flag_value ( $ assoc_args , 'all ' , false ) ) {
31+ $ repos = array_unique ( array_merge ( $ repos , $ this ->get_bundle_repos () ) );
32+ } elseif ( Utils \get_flag_value ( $ assoc_args , 'bundle ' , false ) ) {
2933 $ repos = array_unique ( array_merge ( $ repos , $ this ->get_bundle_repos () ) );
3034 }
3135
@@ -63,13 +67,18 @@ public function close_released( $args, $assoc_args ) {
6367 * [--bundle]
6468 * : Generate releases for the entire bundle.
6569 *
70+ * [--all]
71+ * : Generate releases for all repositories in the wp-cli organization.
72+ *
6673 * @when before_wp_load
6774 */
6875 public function generate ( $ args , $ assoc_args ) {
6976
7077 $ repos = (array ) $ args ;
7178
72- if ( Utils \get_flag_value ( $ assoc_args , 'bundle ' , false ) ) {
79+ if ( Utils \get_flag_value ( $ assoc_args , 'all ' , false ) ) {
80+ $ repos = array_unique ( array_merge ( $ repos , $ this ->get_all_repos () ) );
81+ } elseif ( Utils \get_flag_value ( $ assoc_args , 'bundle ' , false ) ) {
7382 $ repos = array_unique ( array_merge ( $ repos , $ this ->get_bundle_repos () ) );
7483 }
7584
@@ -106,7 +115,12 @@ public function generate( $args, $assoc_args ) {
106115 WP_CLI ::log ( '----- ' );
107116 WP_CLI ::log ( "{$ title } ( {$ tag }) \n{$ release_notes }" );
108117 WP_CLI ::log ( '----- ' );
109- WP_CLI ::confirm ( 'Is the above correct? ' );
118+
119+ fwrite ( STDOUT , 'Is the above correct? ' . ' [y/n] ' );
120+ $ answer = strtolower ( trim ( fgets ( STDIN ) ) );
121+ if ( 'y ' !== $ answer ) {
122+ continue 2 ;
123+ }
110124
111125 WP_CLI ::log ( "Creating release {$ title } {$ tag }... " );
112126 GitHub::create_release ( $ repo , $ tag , 'master ' , $ title , $ release_notes );
@@ -245,6 +259,24 @@ private function repo_heading( $repo, $format ) {
245259 );
246260 }
247261
262+ private function get_all_repos ( $ exclude = null ) {
263+ return array_map (
264+ static function ( $ repo ) {
265+ return $ repo ->full_name ;
266+ },
267+ array_filter (
268+ GitHub::get_organization_repos (),
269+ static function ( $ repo ) use ( $ exclude ) {
270+ if ( null === $ exclude ) {
271+ return $ repo ->archived === false && $ repo ->disabled === false ;
272+ }
273+
274+ return ! in_array ( $ repo ->full_name , (array ) $ exclude , true );
275+ }
276+ )
277+ );
278+ }
279+
248280 private function get_bundle_repos () {
249281 $ repos = [];
250282 $ composer_lock_url = 'https://raw.githubusercontent.com/wp-cli/wp-cli-bundle/master/composer.lock ' ;
0 commit comments