Skip to content

Commit

Permalink
Truncate long validation messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher committed Jul 25, 2023
1 parent 3b437df commit 0e77329
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Themes/Default/ConfirmPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __invoke(ConfirmPrompt $prompt): string
$this->renderOptions($prompt),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/MultiSelectPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __invoke(MultiSelectPrompt $prompt): string
$this->renderOptions($prompt),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/PasswordPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(PasswordPrompt $prompt): string
$prompt->maskedWithCursor($maxWidth),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/SelectPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __invoke(SelectPrompt $prompt): string
$this->renderOptions($prompt),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/SuggestPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __invoke(SuggestPrompt $prompt): string
$this->renderOptions($prompt),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down
2 changes: 1 addition & 1 deletion src/Themes/Default/TextPromptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(TextPrompt $prompt): string
$prompt->valueWithCursor($maxWidth),
color: 'yellow',
)
->warning($prompt->error),
->warning($this->truncate($prompt->error, $prompt->terminal()->cols() - 5)),

default => $this
->box(
Expand Down

0 comments on commit 0e77329

Please sign in to comment.