registry = $registry; } /** * Register every command group. * * @return void */ public function register() { // WP-CLI older than 1.5.0 has no CommandNamespace class. This runs at plugins_loaded, so // a fatal here would break every `wp` command on the site, including the one that // deactivates this plugin — guard it, even though WP-CLI 1.5 is a 2018 release. if ( class_exists( '\WP_CLI\Dispatcher\CommandNamespace' ) ) { \WP_CLI::add_command( 'adminkeep', AdminkeepNamespace::class ); } $io = new WpCliIo(); $writer = new SettingsWriter( $this->registry ); \WP_CLI::add_command( 'adminkeep feature', new FeatureCommand( $this->registry, $writer, $io ) ); \WP_CLI::add_command( 'adminkeep comments', new CommentsCommand( $io ) ); \WP_CLI::add_command( 'adminkeep css', new CssCommand( $io ) ); \WP_CLI::add_command( 'adminkeep smtp', new SmtpCommand( $io ) ); \WP_CLI::add_command( 'adminkeep email-log', new EmailLogCommand( $io ) ); \WP_CLI::add_command( 'adminkeep setting', new SettingCommand( $io ) ); } }