From c30c04d1f903cba63e0239f1eeb95f9927c2a596 Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Fri, 9 Jan 2026 17:43:54 +0100 Subject: [PATCH] Implement common abstract base command --- src/Command/PackageBuildCommand.php | 4 ++-- src/Command/PackageCommand.php | 26 +++++++++++++++++++++++++ src/Command/PackageLoginCommand.php | 4 ++-- src/Command/PackagePublishCommand.php | 4 ++-- src/Command/PackageUnpublishCommand.php | 4 ++-- 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 src/Command/PackageCommand.php diff --git a/src/Command/PackageBuildCommand.php b/src/Command/PackageBuildCommand.php index 9c79298..079418d 100644 --- a/src/Command/PackageBuildCommand.php +++ b/src/Command/PackageBuildCommand.php @@ -14,7 +14,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class PackageBuildCommand extends BaseCommand +class PackageBuildCommand extends PackageCommand { protected function configure(): void { @@ -48,7 +48,7 @@ class PackageBuildCommand extends BaseCommand } if ($registry) { - $credentials = new InsecureStore(); + $credentials = $this->getCredentialsStore(); $providers = [ 'gitea' => new GiteaProvider($credentials) diff --git a/src/Command/PackageCommand.php b/src/Command/PackageCommand.php new file mode 100644 index 0000000..1e719f3 --- /dev/null +++ b/src/Command/PackageCommand.php @@ -0,0 +1,26 @@ +getCredentialsStore(); $io = new SymfonyStyle($input, $output); diff --git a/src/Command/PackagePublishCommand.php b/src/Command/PackagePublishCommand.php index e106518..88adfbf 100644 --- a/src/Command/PackagePublishCommand.php +++ b/src/Command/PackagePublishCommand.php @@ -13,7 +13,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class PackagePublishCommand extends BaseCommand +class PackagePublishCommand extends PackageCommand { protected function configure(): void { @@ -27,7 +27,7 @@ class PackagePublishCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output): int { - $credentials = new InsecureStore(); + $credentials = $this->getCredentialsStore(); $registry = $input->getArgument("registry"); $version = $input->getArgument("version"); diff --git a/src/Command/PackageUnpublishCommand.php b/src/Command/PackageUnpublishCommand.php index 6821a6e..23e181f 100644 --- a/src/Command/PackageUnpublishCommand.php +++ b/src/Command/PackageUnpublishCommand.php @@ -13,7 +13,7 @@ use NoccyLabs\Composer\PackagePlugin\Registry\RegistryFactory; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; -class PackageUnpublishCommand extends BaseCommand +class PackageUnpublishCommand extends PackageCommand { protected function configure(): void { @@ -28,7 +28,7 @@ class PackageUnpublishCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output): int { - $credentials = new InsecureStore(); + $credentials = $this->getCredentialsStore(); $providers = [ 'gitea' => new GiteaProvider($credentials)