diff --git a/packages/publications/src/Commands/MakePublicationCommand.php b/packages/publications/src/Commands/MakePublicationCommand.php
index dff37aa5bf5..77278c964b6 100644
--- a/packages/publications/src/Commands/MakePublicationCommand.php
+++ b/packages/publications/src/Commands/MakePublicationCommand.php
@@ -62,7 +62,7 @@ public function safeHandle(): int
}
$creator->create();
- $this->infoComment('All done! Created file', $creator->getOutputPath());
+ $this->infoComment("All done! Created file [{$creator->getOutputPath()}]");
return Command::SUCCESS;
}
@@ -128,21 +128,21 @@ protected function captureFieldInput(PublicationFieldDefinition $field): ?Public
protected function captureTextFieldInput(PublicationFieldDefinition $field): PublicationFieldValue
{
- $this->infoComment('Enter lines for field', $field->name, '>(end with an empty line)');
+ $this->infoComment("Enter lines for field [$field->name]");
return new PublicationFieldValue(PublicationFieldTypes::Text, implode("\n", InputStreamHandler::call()));
}
protected function captureArrayFieldInput(PublicationFieldDefinition $field): PublicationFieldValue
{
- $this->infoComment('Enter values for field', $field->name, '>(end with an empty line)');
+ $this->infoComment("Enter values for field [$field->name]");
return new PublicationFieldValue(PublicationFieldTypes::Array, InputStreamHandler::call());
}
protected function captureMediaFieldInput(PublicationFieldDefinition $field): ?PublicationFieldValue
{
- $this->infoComment('Select file for image field', $field->name);
+ $this->infoComment("Select file for image field [$field->name]");
$mediaFiles = PublicationService::getMediaForPubType($this->publicationType);
if ($mediaFiles->isEmpty()) {
@@ -155,7 +155,7 @@ protected function captureMediaFieldInput(PublicationFieldDefinition $field): ?P
protected function captureTagFieldInput(PublicationFieldDefinition $field): ?PublicationFieldValue
{
$tagGroup = $field->tagGroup ?? throw new InvalidArgumentException("Tag field '$field->name' is missing the 'tagGroup' property");
- $this->infoComment('Select a tag for field', $field->name, "from the $tagGroup group");
+ $this->infoComment(/** @lang Text */ "Select a tag for field [$field->name] from the $tagGroup group");
$options = PublicationService::getValuesForTagName($tagGroup);
if ($options->isEmpty()) {
diff --git a/packages/publications/src/Commands/MakePublicationTagCommand.php b/packages/publications/src/Commands/MakePublicationTagCommand.php
index 2d681496b96..1ae0985b1d5 100644
--- a/packages/publications/src/Commands/MakePublicationTagCommand.php
+++ b/packages/publications/src/Commands/MakePublicationTagCommand.php
@@ -54,7 +54,7 @@ protected function getTagName(): void
protected function getTagNameFromArgument(?string $value): ?string
{
if ($value) {
- $this->infoComment('Using tag name', $value, 'from command line argument');
+ $this->infoComment("Using tag name [$value] from command line argument");
$this->newLine();
return $value;
@@ -87,9 +87,9 @@ protected function printSelectionInformation(): void
protected function saveTagsToDisk(): void
{
- $this->infoComment('Saving tag data to',
+ $this->infoComment(sprintf('Saving tag data to [%s]',
\Hyde\Console\Concerns\Command::createClickableFilepath('tags.yml')
- );
+ ));
(new PublicationTags)->addTagGroups($this->tags)->save();
}
diff --git a/packages/publications/src/Commands/ValidatePublicationTypesCommand.php b/packages/publications/src/Commands/ValidatePublicationTypesCommand.php
index 4baa5059e12..f640e0ec216 100644
--- a/packages/publications/src/Commands/ValidatePublicationTypesCommand.php
+++ b/packages/publications/src/Commands/ValidatePublicationTypesCommand.php
@@ -81,7 +81,7 @@ protected function validateSchemaFiles(): void
protected function displayResults(): void
{
foreach ($this->results as $name => $errors) {
- $this->infoComment('Validating schema file for', $name);
+ $this->infoComment("Validating schema file for [$name]");
$schemaErrors = $errors['schema'];
if (empty($schemaErrors)) {
diff --git a/packages/publications/src/Commands/ValidatePublicationsCommand.php b/packages/publications/src/Commands/ValidatePublicationsCommand.php
index 8c8907c8e8d..8cf39b6e743 100644
--- a/packages/publications/src/Commands/ValidatePublicationsCommand.php
+++ b/packages/publications/src/Commands/ValidatePublicationsCommand.php
@@ -122,7 +122,7 @@ protected function validatePublicationType(PublicationType $publicationType): vo
protected function displayResults(): void
{
foreach ($this->results as $publicationTypeName => $publications) {
- $this->infoComment('Validating publication type', $publicationTypeName);
+ $this->infoComment("Validating publication type [$publicationTypeName]");
foreach ($publications ?? [] as $publicationName => $errors) {
$this->displayPublicationResults($publicationName, $errors);
}
diff --git a/packages/publications/src/Commands/ValidatingCommand.php b/packages/publications/src/Commands/ValidatingCommand.php
index ce6fa691ecd..5390b7e4328 100644
--- a/packages/publications/src/Commands/ValidatingCommand.php
+++ b/packages/publications/src/Commands/ValidatingCommand.php
@@ -7,9 +7,9 @@
use function __;
use function array_merge;
use Exception;
+use Hyde\Console\Concerns\Command;
use Illuminate\Support\Facades\Validator;
use function in_array;
-use LaravelZero\Framework\Commands\Command;
use RuntimeException;
use function str_ends_with;
use function ucfirst;
@@ -119,14 +119,6 @@ public function handleException(Exception $exception, ?string $file = null, ?int
return Command::FAILURE;
}
- /**
- * Write a nicely formatted and consistent message to the console. Using InfoComment for a lack of a better term.
- */
- public function infoComment(string $info, string $comment, ?string $moreInfo = null): void
- {
- $this->line("$info [$comment]".($moreInfo ? " $moreInfo" : ''));
- }
-
protected function translate(string $name, string $error): string
{
return __($error, [
diff --git a/packages/publications/tests/Feature/ValidatingCommandTest.php b/packages/publications/tests/Feature/ValidatingCommandTest.php
index 1ad8c674ee2..ea320d4de45 100644
--- a/packages/publications/tests/Feature/ValidatingCommandTest.php
+++ b/packages/publications/tests/Feature/ValidatingCommandTest.php
@@ -243,38 +243,6 @@ public function testCanEnableThrowOnException()
$this->assertSame(1, $code);
}
- public function testInfoComment()
- {
- $command = new DynamicValidatingTestCommand();
- $command->closure = function (ValidatingCommand $command) {
- $command->infoComment('foo', 'bar');
- };
- $output = Mockery::mock(OutputStyle::class);
-
- $output->shouldReceive('writeln')->once()->withArgs(function (string $message) {
- return $message === 'foo [bar]';
- });
-
- $command->setOutput($output);
- $command->handle();
- }
-
- public function testInfoCommentWithExtraInfo()
- {
- $command = new DynamicValidatingTestCommand();
- $command->closure = function (ValidatingCommand $command) {
- $command->infoComment('foo', 'bar', 'baz');
- };
- $output = Mockery::mock(OutputStyle::class);
-
- $output->shouldReceive('writeln')->once()->withArgs(function (string $message) {
- return $message === 'foo [bar] baz';
- });
-
- $command->setOutput($output);
- $command->handle();
- }
-
protected function assertEqualsAsBoolean($expected, $question): bool
{
try {