Skip to content

Commit

Permalink
Updated Utils::promptForInput() to allow setting of the prompt charac…
Browse files Browse the repository at this point in the history
…ter. Default is still colon (:)
  • Loading branch information
Alistair Kearney authored and pointybeard committed Oct 7, 2018
1 parent 5b8cd29 commit 4ac216a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Lib/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Utils
* Turns off echoing of input to CLI. Useful for passwords. Only works if bash is avilable.
* @return string
*/
public static function promptForInput($prompt, $silent = false, $default = null, \Closure $validator = null)
public static function promptForInput($prompt, $silent = false, $default = null, \Closure $validator = null, $character=":")
{
if ($silent == true && !self::canInvokeBash()) {
throw new \Exception("bash cannot be invoked from PHP. 'silent' flag cannot be used.");
Expand All @@ -29,7 +29,10 @@ public static function promptForInput($prompt, $silent = false, $default = null,
}

$prompt->message(sprintf(
"%s%s: ", $prompt->message, (!is_null($default) ? " [{$default}]" : null)
"%s%s%s ",
$prompt->message,
(!is_null($default) ? " [{$default}]" : null),
$character
));

do {
Expand Down

0 comments on commit 4ac216a

Please sign in to comment.