From d6f04371eb09b45c4aed5637b0c19f1b169216e3 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sun, 25 Feb 2024 16:44:48 +0000 Subject: [PATCH] Add descriptions to commands --- src/Console/Command/AbstractCommand.php | 4 ++++ src/Console/Command/BuildCommand.php | 2 ++ src/Console/Command/InstallCommand.php | 2 ++ src/Console/Command/PackageInstallCommand.php | 2 ++ src/Console/Command/RunCommand.php | 2 ++ src/Console/Command/TestCommand.php | 2 ++ 6 files changed, 14 insertions(+) diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 576bfd9..f3e4eb2 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -8,6 +8,8 @@ use Symfony\Component\Filesystem\Filesystem; abstract class AbstractCommand extends Command { + protected static string $description; + public function __construct( protected Filesystem $filesystem, ?string $name = null, @@ -17,6 +19,8 @@ abstract class AbstractCommand extends Command protected function configure(): void { + $this->setDescription(static::$description); + $this->addOption( name: 'args', shortcut: 'a', diff --git a/src/Console/Command/BuildCommand.php b/src/Console/Command/BuildCommand.php index a051fb6..046ba65 100644 --- a/src/Console/Command/BuildCommand.php +++ b/src/Console/Command/BuildCommand.php @@ -14,6 +14,8 @@ use Symfony\Component\Filesystem\Filesystem; final class BuildCommand extends AbstractCommand { + public static string $description = 'Build the project'; + public function execute(InputInterface $input, OutputInterface $output): int { $projectType = null; diff --git a/src/Console/Command/InstallCommand.php b/src/Console/Command/InstallCommand.php index 8f721ab..5e6ff52 100644 --- a/src/Console/Command/InstallCommand.php +++ b/src/Console/Command/InstallCommand.php @@ -12,6 +12,8 @@ use Symfony\Component\Filesystem\Filesystem; final class InstallCommand extends AbstractCommand { + public static string $description = 'Install the project\'s dependencies'; + public function execute(InputInterface $input, OutputInterface $output): int { $args = $input->getOption('args'); diff --git a/src/Console/Command/PackageInstallCommand.php b/src/Console/Command/PackageInstallCommand.php index 56548a7..bc8c30a 100644 --- a/src/Console/Command/PackageInstallCommand.php +++ b/src/Console/Command/PackageInstallCommand.php @@ -12,6 +12,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class PackageInstallCommand extends AbstractCommand { + public static string $description = 'Install a new package'; + public function configure(): void { parent::configure(); diff --git a/src/Console/Command/RunCommand.php b/src/Console/Command/RunCommand.php index e32a60d..096b4db 100644 --- a/src/Console/Command/RunCommand.php +++ b/src/Console/Command/RunCommand.php @@ -13,6 +13,8 @@ use Symfony\Component\Filesystem\Filesystem; final class RunCommand extends AbstractCommand { + public static string $description = 'Run the project'; + public function execute(InputInterface $input, OutputInterface $output): int { $projectType = null; diff --git a/src/Console/Command/TestCommand.php b/src/Console/Command/TestCommand.php index 03db04a..139dfe3 100644 --- a/src/Console/Command/TestCommand.php +++ b/src/Console/Command/TestCommand.php @@ -9,6 +9,8 @@ use Symfony\Component\Console\Output\OutputInterface; final class TestCommand extends AbstractCommand { + public static string $description = 'Run the project\'s tests'; + public function execute(InputInterface $input, OutputInterface $output): int { $args = $input->getOption('args');