Skip to content

Commit

Permalink
Add CLI command scaffolding
Browse files Browse the repository at this point in the history
  • Loading branch information
schlessera committed Mar 25, 2019
1 parent d7d04ac commit 9852dce
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
60 changes: 60 additions & 0 deletions src/Console/AsmpCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* ASMP WordPress Integration Plugin.
*
* @package ASMP\WordPressIntegration
* @license MIT
* @link https://www.alainschlesser.com/asmp
*/

namespace ASMP\WordPressIntegration\Console;

use WP_CLI;

final class AsmpCommand {

/**
* Run a check against ASMP.
*
* @param array $args Positional arguments.
* @param array $assoc_args Associative arguments.
*/
public function check( array $args, array $assoc_args ) {
WP_CLI::error( 'Not implemented yet' );
}

/**
* Request a change through ASMP.
*
* @param array $args Positional arguments.
* @param array $assoc_args Associative arguments.
*/
public function change( array $args, array $assoc_args ) {
WP_CLI::error( 'Not implemented yet' );
}

/**
* Roll back a change through ASMP.
*
* @param array $args Positional arguments.
* @param array $assoc_args Associative arguments.
*/
public function rollback( array $args, array $assoc_args ) {
WP_CLI::error( 'Not implemented yet' );
}

/**
* Run a check against ASMP.
*
* ## OPTIONS
*
* <id>
* : ID of the change to roll back.
*
* @param array $args Positional arguments.
* @param array $assoc_args Associative arguments.
*/
public function status( array $args, array $assoc_args ) {
WP_CLI::error( 'Not implemented yet' );
}
}
33 changes: 33 additions & 0 deletions src/ConsoleIntegration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php
/**
* ASMP WordPress Integration Plugin.
*
* @package ASMP\WordPressIntegration
* @license MIT
* @link https://www.alainschlesser.com/asmp
*/

namespace ASMP\WordPressIntegration;

use ASMP\WordPressIntegration\Infrastructure\Registerable;
use ASMP\WordPressIntegration\Infrastructure\Service;
use WP_CLI;

/**
*
*/
final class ConsoleIntegration implements Service, Registerable {

/**
* Register the service.
*
* @return void
*/
public function register(): void {
if ( ! class_exists( 'WP_CLI' ) ) {
return;
}

WP_CLI::add_command( 'asmp', Console\AsmpCommand::class );
}
}
1 change: 1 addition & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private function get_service_classes(): array {
// Add services as FQCNs here.
ViewFactory::class,
SettingsGeneralService::class,
ConsoleIntegration::class,
] );
}
}

0 comments on commit 9852dce

Please sign in to comment.