Skip to content

Commit

Permalink
Add info note (#36)
Browse files Browse the repository at this point in the history
* add info note

* Update helpers.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
sebastianpopp and taylorotwell authored Aug 7, 2023
1 parent e65a276 commit 1b3ab52
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions playground/notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use function Laravel\Prompts\alert;
use function Laravel\Prompts\error;
use function Laravel\Prompts\info;
use function Laravel\Prompts\intro;
use function Laravel\Prompts\note;
use function Laravel\Prompts\outro;
Expand All @@ -11,6 +12,7 @@

intro('Intro');
note('Note');
info('Info');
warning('Warning');
error('Error');
alert('Alert');
Expand Down
5 changes: 5 additions & 0 deletions src/Themes/Default/NoteRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ public function __invoke(Note $note): string

return $this;

case 'info':
$lines->each(fn ($line) => $this->line($this->green(" {$line}")));

return $this;

default:
$lines->each(fn ($line) => $this->line(" {$line}"));

Expand Down
8 changes: 8 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ function alert(string $message): void
(new Note($message, 'alert'))->display();
}

/**
* Display an informational message.
*/
function info(string $message): void
{
(new Note($message, 'info'))->display();
}

/**
* Display an introduction.
*/
Expand Down

0 comments on commit 1b3ab52

Please sign in to comment.