Skip to content

Commit

Permalink
Add suggestion output style
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed Mar 28, 2021
1 parent 309b791 commit 02c8e7e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src-tests/Console/Style/Fixtures/suggestion.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

[💡] Suggestion message

10 changes: 10 additions & 0 deletions src-tests/Console/Style/StewardStyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@ public function testShouldFormatNote(): void
);
}

public function testShouldFormatSuggestion(): void
{
$this->style->suggestion('Suggestion message');

$this->assertStringEqualsFile(
__DIR__ . '/Fixtures/suggestion.txt',
$this->normalizeLineEndings($this->outputBuffer->fetch())
);
}

public function testShouldFormatQuestion(): void
{
$inputMock = $this->getMockBuilder(StreamableInputInterface::class)->getMock();
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

$this->io->note('Downloading may take a while... (File size over 20 MB.)');
$this->io->note('Downloading may take a while... (File size is over 20 MB.)');
}

$downloadedSize = $downloader->download();
Expand Down Expand Up @@ -179,7 +179,7 @@ private function askForVersion(bool $isInteractiveInput): string

private function printLinkToWiki(): void
{
$this->io->note(
$this->io->suggestion(
'What now? Learn how to start the Selenium server: '
. 'https://github.com/lmc-eu/steward/wiki/Selenium-server-&-browser-drivers'
);
Expand Down
5 changes: 5 additions & 0 deletions src/Console/Style/StewardStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ public function note($message): void
$this->symfonyStyle->block($message, 'NOTE', 'fg=yellow', ' ');
}

public function suggestion($message): void
{
$this->symfonyStyle->block($message, '💡', 'fg=yellow', ' ');
}

public function caution($message): void
{
throw new \BadMethodCallException('Method not implemented');
Expand Down

0 comments on commit 02c8e7e

Please sign in to comment.