Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chaz6chez committed Aug 20, 2024
1 parent 88bdb40 commit e79d6b9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
34 changes: 34 additions & 0 deletions src/Commands/AbstractCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,52 @@

abstract class AbstractCommand extends Command
{
/**
* 兼容webman console,需重写
*
* @var string
*/
protected static string $defaultName = '';

/**
* 兼容webman console,需重写
*
* @var string
*/
protected static string $defaultDescription = '';

/**
* 输出info
*
* @param OutputInterface $output
* @param string $message
* @return void
*/
protected function info(OutputInterface $output, string $message): void
{
$output->writeln("ℹ️ $message");
}

/**
* 输出error
*
* @param OutputInterface $output
* @param string $message
* @return int
*/
protected function error(OutputInterface $output, string $message): int
{
$output->writeln("$message");
return self::FAILURE;
}

/**
* 输出success
*
* @param OutputInterface $output
* @param string $message
* @return int
*/
protected function success(OutputInterface $output, string $message): int
{
$output->writeln("$message");
Expand Down
6 changes: 4 additions & 2 deletions src/Commands/WorkbunnyWebmanSharedCacheClean.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

class WorkbunnyWebmanSharedCacheClean extends AbstractCommand
{
protected static string $defaultName = 'workbunny:shared-cache-clean';
protected static string $defaultDescription = 'Remove all workbunny/webman-shared-cache caches. ';

/**
* @return void
*/
protected function configure(): void
{
$this->setName('workbunny:shared-cache-clean')
->setDescription('Remove all workbunny/webman-shared-cache caches. ');
$this->setName(static::$defaultName)->setDescription(static::$defaultDescription);
}

/**
Expand Down
7 changes: 4 additions & 3 deletions src/Commands/WorkbunnyWebmanSharedCacheList.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

class WorkbunnyWebmanSharedCacheList extends AbstractCommand
{
protected static string $defaultName = 'workbunny:shared-cache-list';
protected static string $defaultDescription = 'Show workbunny/webman-shared-cache caches list. ';

/**
* @return void
*/
protected function configure(): void
{
$this->setName('workbunny:shared-cache-list')
->setDescription('Show workbunny/webman-shared-cache caches list. ');

$this->setName(static::$defaultName)->setDescription(static::$defaultDescription);
$this->addOption('page', 'p', InputOption::VALUE_OPTIONAL, 'Page. ', 1);
$this->addOption('size', 's', InputOption::VALUE_OPTIONAL, 'Page size. ', 20);
}
Expand Down

0 comments on commit e79d6b9

Please sign in to comment.