Skip to content

Commit

Permalink
Merge pull request #7977 from kenjis/fix-CLI-prompt-msg
Browse files Browse the repository at this point in the history
fix: CLI prompt validation message
  • Loading branch information
kenjis authored Oct 10, 2023
2 parents 49d3421 + cbeb86f commit eb1e7f6
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static function init()
* Named options must be in the following formats:
* php index.php user -v --v -name=John --name=John
*
* @param string $prefix You may specify a string with which to prompt the user.
* @param string|null $prefix You may specify a string with which to prompt the user.
*/
public static function input(?string $prefix = null): string
{
Expand Down Expand Up @@ -210,9 +210,9 @@ public static function input(?string $prefix = null): string
* // Do not provide options but requires a valid email
* $email = CLI::prompt('What is your email?', null, 'required|valid_email');
*
* @param string $field Output "field" question
* @param array|string $options String to a default value, array to a list of options (the first option will be the default value)
* @param array|string $validation Validation rules
* @param string $field Output "field" question
* @param array|string $options String to a default value, array to a list of options (the first option will be the default value)
* @param array|string|null $validation Validation rules
*
* @return string The user input
*
Expand Down Expand Up @@ -258,7 +258,7 @@ public static function prompt(string $field, $options = null, $validation = null
$input = trim(static::input()) ?: $default;

if ($validation) {
while (! static::validate(trim($field), $input, $validation)) {
while (! static::validate('"' . trim($field) . '"', $input, $validation)) {
$input = static::prompt($field, $options, $validation);
}
}
Expand Down Expand Up @@ -448,7 +448,7 @@ public static function print(string $text = '', ?string $foreground = null, ?str
}

/**
* Outputs a string to the cli on it's own line.
* Outputs a string to the cli on its own line.
*
* @return void
*/
Expand Down Expand Up @@ -574,10 +574,10 @@ public static function clearScreen()
* Returns the given text with the correct color codes for a foreground and
* optionally a background color.
*
* @param string $text The text to color
* @param string $foreground The foreground color
* @param string $background The background color
* @param string $format Other formatting to apply. Currently only 'underline' is understood
* @param string $text The text to color
* @param string $foreground The foreground color
* @param string|null $background The background color
* @param string|null $format Other formatting to apply. Currently only 'underline' is understood
*
* @return string The color coded string
*/
Expand Down Expand Up @@ -834,7 +834,7 @@ public static function showProgress($thisStep = 1, int $totalSteps = 10)
* width.
*
* If an int is passed into $pad_left, then all strings after the first
* will padded with that many spaces to the left. Useful when printing
* will pad with that many spaces to the left. Useful when printing
* short descriptions that need to start on an existing line.
*/
public static function wrap(?string $string = null, int $max = 0, int $padLeft = 0): string
Expand Down

0 comments on commit eb1e7f6

Please sign in to comment.