wp-plugin-boilerplate/includes/class-nmspcli.php

47 lines
1.0 KiB
PHP

<?php
namespace PluginNamespace;
use WP_CLI;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class NmspCli {
/**
* Class constructor. Can add commands here.
*
* @package PluginNamespace\NmspCli
* @since 1.0.0
*
* @return void
*/
public function __construct() {
WP_CLI::add_command(
'nmsp-plugin do',
array( $this, 'do_the_thing' ),
array(
'shortdesc' => __( 'The short description.', 'nmsp-plugin-name-text-domain' ),
'longdesc' => __( "This is the super long description that will go on and on my friend. Some people started writing it not knowing what it was, and we'll continue writing it forever just because this is the description that never ends...", 'nmsp-plugin-name-text-domain' ),
),
);
}
/**
* A sample method where something is done by being invoked from WP CLI.
*
* @package PluginNamespace\NmspCli
* @since 1.0.0
*
* @return void
*/
public function do_the_thing(): void {
WP_CLI::success( __( 'Congradulations, it is working.', 'nmsp-plugin-name-text-domain' ) );
}
}
new NmspCli();